[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: equivalent for C-style init: structname varname[] = {...} ?
From: |
Dimitri Maziuk |
Subject: |
Re: equivalent for C-style init: structname varname[] = {...} ? |
Date: |
Mon, 19 Nov 2012 12:35:16 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121030 Thunderbird/10.0.10 |
On 11/19/2012 12:06 PM, Jordi Gutiérrez Hermoso wrote:
> Okay, that gives me enough information to diagnose the problem. It's
> unrelated to structs, as I guessed.
>
> The problem is that (1) Octave arrays are of homogenous type (2)
> strings are arrays of char type. So when you're doing
>
> row = [1, 2, 3, 4];
> r(2) = "lol",
>
> you're attempting to assign an array of size 3 to a single location in
> row, the 2nd entry.
The way I see it I am trying to assign 4.410 to row(5) previously
initialized to -100.0.
I'm storing 4.410 in a struct next to "HE", a struct is actually a map,
and map values are indeed of homogenous type. Hence "4.410" interpreted
as ['4', '.', '4', '1', '0'].
If it's any consolation, it's a generally undecidable problem inherent
in all typeless languages: what should 'if( "42" == 42 )' evaluate to
and should 'if( "42" == (42) )' evaluate to the same thing. Octave's not
alone there (though it's the worst I've seen so far).
--
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu
signature.asc
Description: OpenPGP digital signature
- Re: equivalent for C-style init: structname varname[] = {...} ?, (continued)
- Re: equivalent for C-style init: structname varname[] = {...} ?, Salva Ardid, 2012/11/21
- Re: equivalent for C-style init: structname varname[] = {...} ?, Dimitri Maziuk, 2012/11/21
- Re: equivalent for C-style init: structname varname[] = {...} ?, c., 2012/11/21
- Re: equivalent for C-style init: structname varname[] = {...} ?, Sergei Steshenko, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Ben Abbott, 2012/11/20
- Re: equivalent for C-style init: structname varname[] = {...} ?, Francesco Potortì, 2012/11/21
- Re: equivalent for C-style init: structname varname[] = {...} ?,
Dimitri Maziuk <=
- Re: equivalent for C-style init: structname varname[] = {...} ?, Jordi Gutiérrez Hermoso, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Sergei Steshenko, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Dimitri Maziuk, 2012/11/19
- Re: equivalent for C-style init: structname varname[] = {...} ?, Sergei Steshenko, 2012/11/19
- Acknowledge in paper, Ismael Diego Nunez-Riboni, 2012/11/14
- Re: Acknowledge in paper, Juan Pablo Carbajal, 2012/11/14
- Re: Acknowledge in paper, Nicholas Jankowski, 2012/11/14
- Re: Acknowledge in paper, c., 2012/11/14
- Re: Acknowledge in paper, Nicholas Jankowski, 2012/11/14
- Re: Acknowledge in paper, Ismael Diego Nunez-Riboni, 2012/11/14