microsoft / GSL

Guidelines Support Library
Other
6.13k stars 737 forks source link

1075 Wrong Expects in gsl::at? #1076

Closed beinhaerter closed 1 year ago

beinhaerter commented 1 year ago

https://github.com/microsoft/GSL/issues/1075

dmitrykobets-msft commented 1 year ago

Looks good, thanks for being patient with the review.

diamante0018 commented 1 year ago

Hello, following the merging of this PR I get the following warning with latest MSVC (using GitHub's workflows) which causes a compilation error as all warnings are treated as errors in my workflow.

<my project>\deps\GSL\include\gsl\util(114,86): warning C4003: not enough arguments for function-like macro invocation 'max'

I can work around this by suppressing this warning specifically but please consider looking into this. Thanks.

dmitrykobets-msft commented 1 year ago

@diamante0018 ah this seems to be a known issue with windows header users https://github.com/skypjack/entt/issues/343. I'll make a PR implementing the parentheses fix, but defining NOMINMAX as illustrated here (https://stackoverflow.com/questions/6884093/warning-c4003-not-enough-actual-parameters-for-macro-max-visual-studio-2010) should also work locally for you.

diamante0018 commented 1 year ago

I ended up undef'ing the min max macros yeah. That seems to be a popular fix/workaround for this issue. Thanks.