When I try to compile this code, I get a Case Expression Not Constant
error. I can't figure out why.
while ((*datalen) == 0)
crReturn(NULL); //error here
st->len = (st->len << 8) + **data;
The function crReturn() is defined as following.
#define crReturn(z) \
do {\
*crLine =__LINE__; return (z); case __LINE__:;\
} while (0)
The problem is that MSVC++ does something nonstandard (and contrary to its own documentation) when it's configured to generate debug information for its "edit and continue" feature, and that this nonstandard breaks the way that __LINE__
is used in Simon Tatham's coroutine macros.
Here's what the comments in the PuTTY source code say about this:
In particular, if you are getting `case expression not constant'
errors when building with MS Visual Studio, this is because MS's
Edit and Continue debugging feature causes their compiler to
violate ANSI C. To disable Edit and Continue debugging:
- right-click ssh.c in the FileView
- click Settings
- select the C/C++ tab and the General category
- under `Debug info:', select anything _other_ than `Program
Database for Edit and Continue'.
So you should probably do that. (In fact, I know that you already did, because we discussed this in comments before I posted this answer :-).)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With