This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strict aliasing: how to swap pointers


JÄdrzej Dudkiewicz wrote:
>>  > #define SWAP(TYPE, A, B) do { TYPE tmp = a; b = b; b = tmp; } while (0)
>>
>>  Err,
>>  #define SWAP(TYPE, A, B) do { TYPE tmp = a; a = b; b = tmp; } while (0)
> 
> Seems that
> 
> #define SWAP(TYPE, A, B) do { TYPE tmp = A; A = B; B = tmp; } while (0)
> 
> would be even better.

No kidding.  :-)

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]