Re: Adding the ability to add functions into structures?



jacob navia <jacob@xxxxxxxxxxxxxxxx> writes:
> Eric Sosman a écrit :
>> jacob navia wrote:
>>
>>> [...]
>>> For instance:
>>>
>>> 1) I define a forward declaration to the object
>>> typedef struct _ArrayList ArrayList;
>> Have you forgotten that the identifier `_ArrayList'
>> is off-limits?
>> "All identifiers that begin with an underscore and
>> either an uppercase letter or another underscore
>> are always reserved for any use."
>> -- ISO/IEC 9899:1999 section 7.1.3 paragraph 1
>>
> Yes, you are right. Just put
> typedef struct tagArrayList
>
> Sometimes I use _ because is shorter

Why not just use

struct ArrayList {
...
};

and then consistently refer to the type as "struct ArrayList"? What
benefit does the typedef give you? (If you think not having to type
the word "struct" is enough of a benefit, I disagree but I won't argue
about it.)

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: Shared Objects Libraries and Symbols...
    ... ~ 1 An identifier declared in different scopes or in the same scope more ... There are three kinds of linkage: ... each declaration of an identifier with internal ... ~ 4 For an identifier declared with the storage-class specifier extern ...
    (comp.os.linux.development.apps)
  • Re: Newbie static class member question [C++]
    ... > class declaration, but define them outside of it (as a general ... meaning of an identifier. ... The definition tells the compiler to generate code to allocate memory ... One such namespace is global, ...
    (alt.comp.lang.learn.c-cpp)
  • Namespace problems when compiling (xutility)
    ... I am trying to compile my project with MTL (Matrix Template Library) and I am ... undeclared identifier ...
    (microsoft.public.vc.language)
  • Re: trailing double underscores
    ... Specify how to "decorate" external Fortran ... is a Fortran identifier and the second is the linker ... underscore, and "2" says to append two underscores ...
    (comp.lang.fortran)
  • Re: trailing double underscores
    ... Specify how to "decorate" external Fortran ... is a Fortran identifier and the second is the linker ... underscore, and "2" says to append two underscores ...
    (comp.lang.fortran)