help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: equivalent for C-style init: structname varname[] = {...} ?


From: Jordi Gutiérrez Hermoso
Subject: Re: equivalent for C-style init: structname varname[] = {...} ?
Date: Sun, 18 Nov 2012 12:10:25 -0500

On 18 November 2012 11:53, Dimitri Maziuk <address@hidden> wrote:
> On 11/17/2012 7:48 PM, Sergei Steshenko wrote:
>
>> In Octave structs are associative arrays.
>
>
> Is that documented somewhere or is it lie the rest of octave "documentation"
> -- you're supposed to already know matlab?

Octave structs are not associative arrays. Part of their
implementation detail is that C++'s std::map is used to implement
them, and this is casually mentioned in the manual. SS has latched on
to this statement and concluded Octave is like Perl, or it's buggy
because it's not like Perl.

Octave's structs are supposed to look a lot more like C structs than
like Python dictionaries or Perl hashes or PHP arrays.

> Because it certainly explains why I can't have mixed-type fields in a
> struct.

The fieldnames in a struct are subject to the same constraints that
variable names are. In essence, they have to start with a letter, no
spaces, and may only contain letters, numbers, and underscores.

- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]