tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Definitions of types also as macros

In article <pn1n59$oj0$>,
Christos Zoulas <> wrote:
>In article <20180908230813.GA22777%SDF.ORG@localhost>,  <> wrote:
>>we do this in stdint.h and some other headers:
>>#ifndef uint32_t
>>typedef __uint32_t      uint32_t;
>>#define uint32_t        __uint32_t
>>Real-world examples:
>>And now I ran into:
>>Proposal: let's not define the macros?
>>I don't know if there are long running consequences for it.
>The problem is that these are defined in multiple headers and
>typedef redefinition with the same type is a c11 feature, so the
>define protects against that. Of course one can use a different
>macro and this was done before, but this has other disadvantages.

The other approach is:

#ifdef  _BSD_TIME_T_
typedef _BSD_TIME_T_    time_t;
#undef  _BSD_TIME_T_


Home | Main Index | Thread Index | Old Index