google / gumbo-parser

An HTML5 parsing library in pure C99
Apache License 2.0
5.16k stars 660 forks source link

Compiling on Visual Studio in C++ mode has issues with compound literals. #380

Closed Zerophase closed 1 year ago

Zerophase commented 7 years ago

I think the only thing I need to replace to get this to compile on Visual Studio is the compound literals. The only thing is I'm not sure how to do that in a C++ standard compliant way. The larger application I'm developing has been using Clang, which understands compound literals damn well in C++, but GCC has some issues, and MSVC almost definitely has issues with them. Is there a means of replacing the compound literals in C friendly way? The only solution I've come up with so far involves variadic templates, but I believe the ones I've written need some massaging to work correctly.

kevinhendricks commented 7 years ago

FWIW, VS C compiler support has been greatly improved in more recent releases. The Sigil project regulularly uses Microsofts free VS C to compile our fork of gumbo into a dll that functions just fine.

Zerophase commented 7 years ago

Alright, I'll have to check that out.

kevinhendricks commented 7 years ago

our fork can be found here but the approach should work just as well with this (upstream) gumbo. https://github.com/Sigil-Ebook/Sigil/tree/master/internal/gumbo

Zerophase commented 7 years ago

Thanks.