LINUX.ORG.RU

История изменений

Исправление SZT, (текущая версия) :

Нет, не прокатит

https://godbolt.org/z/1WiMkz

<source>: In function 'main':
<source>:1:51: warning: operation on 'a' may be undefined [-Wsequence-point]
   #define bswap16(x) (((unsigned short)(x))<<8 | ((unsigned short)(x))>>8)
                                                  ~^~~~~~~~~~~~~~~~~~~~
<source>:2:33: note: in expansion of macro 'bswap16'
   #define m__builtin_bswap16(x) bswap16((unsigned short)(x))
                                 ^~~~~~~
<source>:7:22: note: in expansion of macro 'm__builtin_bswap16'
   unsigned short b = m__builtin_bswap16(a++);
                      ^~~~~~~~~~~~~~~~~~
Compiler returned: 0

Исправление SZT, :

Нет, не прокатит

https://godbolt.org/z/1WiMkz

<source>: In function 'main':

<source>:1:51: warning: operation on 'a' may be undefined [-Wsequence-point]

   #define bswap16(x) (((unsigned short)(x))<<8 | ((unsigned short)(x))>>8)

                                                  ~^~~~~~~~~~~~~~~~~~~~

<source>:2:33: note: in expansion of macro 'bswap16'

   #define m__builtin_bswap16(x) bswap16((unsigned short)(x))

                                 ^~~~~~~

<source>:7:22: note: in expansion of macro 'm__builtin_bswap16'

   unsigned short b = m__builtin_bswap16(a++);

                      ^~~~~~~~~~~~~~~~~~

Compiler returned: 0

Исходная версия SZT, :

Нет, не прокатит