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:
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 :-).)