C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

types with names ending in _t

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Michel
Guest





PostPosted: Sun Apr 17, 2005 3:39 pm    Post subject: types with names ending in _t Reply with quote



Are typenames ending with _t eg Foo_t reserved?
Are there any general advice of when they should or shouldn't be used?
I tend to use it for typedefs and enums in my own namespaces.

/Michel

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Maxim Yegorushkin
Guest





PostPosted: Mon Apr 18, 2005 9:07 am    Post subject: Re: types with names ending in _t Reply with quote



On 17 Apr 2005 11:39:45 -0400, Michel <michel.andre (AT) swipnet (DOT) se> wrote:

Quote:
Are typenames ending with _t eg Foo_t reserved?
Are there any general advice of when they should or shouldn't be used?
I tend to use it for typedefs and enums in my own namespaces.

They are reserved by POSIX. Please see
http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html

--
Maxim Yegorushkin

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Jack Klein
Guest





PostPosted: Mon Apr 18, 2005 9:10 am    Post subject: Re: types with names ending in _t Reply with quote



On 17 Apr 2005 11:39:45 -0400, Michel <michel.andre (AT) swipnet (DOT) se> wrote
in comp.lang.c++.moderated:

Quote:
Are typenames ending with _t eg Foo_t reserved?
Are there any general advice of when they should or shouldn't be used?
I tend to use it for typedefs and enums in my own namespaces.

/Michel

Only names actually defined by the C and C++ standards ending in _t
are reserved. Note that the current C standard defines a lot of
integer types, some required and some optional, in the C header
<stdint.h>, ending in _t. This is not yet a part of C++ but almost
certainly will be in the future. Even then, they would not be
reserved unless you actually included <cstdint> as it would presumably
be named in C++.

The POSIX standard, IIRC, reserves all identifiers ending in _t, but
that shouldn't be a problem as long is you keep them in their own
namespaces and don't hoist them into the global namespace with overly
broad using directives.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Gino van den Bergen
Guest





PostPosted: Mon Apr 18, 2005 11:04 am    Post subject: Re: types with names ending in _t Reply with quote

Would it be fair to say that (future) reserved words ending with "_t"
all start with a lower case character? It has been up until now. So, if
you define your own types starting with an upper case character, you're
cleared of potential future name clashes with reserved words?

Gino

Jack Klein wrote:
Quote:
On 17 Apr 2005 11:39:45 -0400, Michel <michel.andre (AT) swipnet (DOT) se> wrote
in comp.lang.c++.moderated:


Are typenames ending with _t eg Foo_t reserved?
Are there any general advice of when they should or shouldn't be used?
I tend to use it for typedefs and enums in my own namespaces.

/Michel


Only names actually defined by the C and C++ standards ending in _t
are reserved. Note that the current C standard defines a lot of
integer types, some required and some optional, in the C header
stdint.h>, ending in _t. This is not yet a part of C++ but almost
certainly will be in the future. Even then, they would not be
reserved unless you actually included <cstdint> as it would presumably
be named in C++.

The POSIX standard, IIRC, reserves all identifiers ending in _t, but
that shouldn't be a problem as long is you keep them in their own
namespaces and don't hoist them into the global namespace with overly
broad using directives.


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.