casting an lvalue in C++

Andrew Pimlott pimlott@idiomtech.com
Mon Dec 27 23:34:00 GMT 1999


g++ and Visual C++ disagreed about some code like this:

int main(int argc, char **argv)
{
    char *c;
    void *v;
    (void *) c = v;
}

g++ -Wall compiled it without warnings, but Visual C++ complained that
the left side is not an lvalue.  I found a microsoft document that says
it is right according to the C++ standard:
http://support.microsoft.com/support/kb/articles/Q88/4/34.ASP .

I assume that g++ should warn about non-standard constructs even if it
can compile them, right?

Andrew


More information about the Gcc-bugs mailing list