Snaipe / libcsptr

Smart pointers for the (GNU) C programming language
https://snai.pe/c/c-smart-pointers/
MIT License
1.57k stars 143 forks source link

not support MSVC #26

Open tkorays opened 1 year ago

tkorays commented 1 year ago

We use C in windows with MSVC compiler, but __attribute__((cleanup)) does not work in MSVC. Is is possible to support MSVC?

Snaipe commented 1 year ago

Not really. MSVC has no practical equivalent to the cleanup attribute, which is why there is a disclaimer that this only works for GNU C.

bogen85 commented 1 year ago

Clang and Intel C Compiler supposedly support this. https://clang.llvm.org/docs/AttributeReference.html#cleanup https://community.intel.com/t5/Intel-C-Compiler/variable-attribute-cleanup-support/td-p/777276

Snaipe commented 1 year ago

Yes, clang and icc count as a GNU-flavored C, since they want to match GCC's general behavior. But MSVC does not, and therefore cannot work with this library.