Re: Definitions of types also as macros
On Wed, Nov 07, 2018 at 05:43:49AM +0300, Valery Ushakov wrote: > On Tue, Nov 06, 2018 at 23:20:16 +0100, Rhialto wrote: > > > On Tue 06 Nov 2018 at 23:19:08 +0300, Valery Ushakov wrote: > > > Also your change breaks redefining intN_t types with the preprocessor. > > > E.g. > > > > > > #define uint32_t unsigned long long > > > #include > > > > > > is now broken with your change. > > > > But should that really be allowed? > > I have no idea :) But then I saw enough of unholy cpp trickery to > consider that as a possibility, its legal status notwithstanding. I'd rather not encourage it. For the example provided the behaviour is undefined, but not prohibited. ;-) - Klaus
Re: Definitions of types also as macros
On 09.11.2018 12:17, Klaus Klein wrote: > On Thu, Nov 08, 2018 at 09:08:04AM +, David Holland wrote: >> On Tue, Nov 06, 2018 at 03:07:16PM +, co...@sdf.org wrote: >> > I wanna do this, looks good? >> >> It should probably use double wings: >> >> > -#ifndef int8_t >> > +#ifndef _BSD_INT8_T_ >> >>+#ifndef __BSD_INT8_T__ > > In terms of namespace consumption, the single leading underscore > followed by an uppercase letter as used here is sufficient. > > > - Klaus > We alredy use this syntax, eg. in : #ifdef _BSD_TIME_T_ typedef _BSD_TIME_T_time_t; #undef _BSD_TIME_T_ #endif (however here the ifdef is switched for some reason) signature.asc Description: OpenPGP digital signature
Re: Definitions of types also as macros
On Thu, Nov 08, 2018 at 09:08:04AM +, David Holland wrote: > On Tue, Nov 06, 2018 at 03:07:16PM +, co...@sdf.org wrote: > > I wanna do this, looks good? > > It should probably use double wings: > > > -#ifndef int8_t > > +#ifndef _BSD_INT8_T_ > >+#ifndef __BSD_INT8_T__ In terms of namespace consumption, the single leading underscore followed by an uppercase letter as used here is sufficient. - Klaus