 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michel Guest
|
Posted: Sun Apr 17, 2005 3:39 pm Post subject: types with names ending in _t |
|
|
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
|
Posted: Mon Apr 18, 2005 9:07 am Post subject: Re: types with names ending in _t |
|
|
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
|
Posted: Mon Apr 18, 2005 9:10 am Post subject: Re: types with names ending in _t |
|
|
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
|
Posted: Mon Apr 18, 2005 11:04 am Post subject: Re: types with names ending in _t |
|
|
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 |
|
 |
|
|
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
|
|