Re: Adding the ability to add functions into structures?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Sat, 31 Dec 2005 19:04:18 GMT
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.
.
- References:
- Adding the ability to add functions into structures?
- From: Albert
- Re: Adding the ability to add functions into structures?
- From: jacob navia
- Re: Adding the ability to add functions into structures?
- From: Eric Sosman
- Re: Adding the ability to add functions into structures?
- From: jacob navia
- Adding the ability to add functions into structures?
- Prev by Date: Re: How to understand this line of c ?
- Next by Date: Re: How to understand this line of c ?
- Previous by thread: Re: Adding the ability to add functions into structures?
- Next by thread: Re: Adding the ability to add functions into structures?
- Index(es):
Relevant Pages
|