Hi Vitaliy,

Thanks for the feedback on the MSVC build. I put a couple responses inline.

On Wed, Jul 5, 2017 at 10:06 AM, Vitaliy Bondarchuk <
[email protected]> wrote:

> hi guys
>
> I switched to 0.6.1 and had to workaround 3 issues
>

[snip macro and warning workaround code]

Indeed, the min, max, VOID, etc. macros, and the gratuitous warnings
emitted by MSVC, are long-standing issues that would be great to get
resolved. I had hoped I'd have had time to fix them by now, but have been
caught up in work and now vacation.

For warnings, the approach you outlined is the only complete solution I can
see to clean them up.

For macros, we have a couple other options. `min` and `max` could be
parenthesized in Cap'n Proto code to prevent the preprocessor from
interpreting them as function-like macros. I believe this is common
practice among Windows programmers, though I didn't learn the trick until
recently.

That leaves VOID and friends. Kenton has suggested converting them into
global-scope symbols, exemplified here:
https://github.com/capnproto/capnproto/blob/master/c%2B%2B/src/kj/windows-sanity.h#L33

He wrote some rationale here:
https://groups.google.com/d/msg/capnproto/glQHUGVIlN0/an2htV_FAQAJ

It feels weird to me to convert a foreign macro into a symbol, but after
thinking about it, I don't see any downside. Do you have an opinion either
way?

3. it looks like somewhy cmake doesn't include c++\src\kj\units.c++ into
> the static library. I got linking error. As workaround I just copy-pasted
> the piece of code from c++\src\kj\units.c++ to one of my cpp files and my
> binary liked successfully.
>

This one is new to me. If possible, can you provide a minimal test case
that demonstrates the compile error, perhaps by modifying the code in
c++/samples to make it break? I'm on vacation for the next couple weeks,
but will look at it when I get home.

Thanks,
Harris

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to