nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
25.99k stars 7.67k forks source link

stb_image_resize2.h: 'asm' is not recognized keyword in '-std=c99' mode #1525

Closed fp64 closed 9 months ago

fp64 commented 9 months ago

stb_image_resize2.h fails to compile under -std=c99: https://godbolt.org/z/aYbKdzGzj

It works fine in -std=gnu99, and also in C++. Technically, asm keyword is an extension to C Standard (but "conditionally-supported and implementation defined" part of C++ Standard proper): https://en.cppreference.com/w/c/language/asm https://en.cppreference.com/w/cpp/language/asm

The fix is simple: replace asm with __asm__, which should work in all __GNUC__ compilers. I'd imagine -std=c99 is common enough to justify the fix.

nothings commented 9 months ago

fixed