int main()
{
       int var;
       char string[50];
       
       (var, string);
       (0);
       (0, 1, 2);
 
       return 0;
}

Reply ASAP
Thanks in advance
Govinda Attal.

Several no-ops? What is your question?

This code does compile and generates an exe file...When I went thru disassembly, I found nothing useful in it...There were no nops in it. First of all our basic coding principles say that it should give a compiler error... compilers like msvc, gcc simply pass without giving any error or warnings..

This code does compile and generates an exe file...When I went thru disassembly, I found nothing useful in it...There were no nops in it. First of all our basic coding principles say that it should give a compiler error... compilers like msvc, gcc simply pass without giving any error or warnings..

I compiled to assembly and peeked at it too. The compiler just optimizes the NOPs out, so you pretty much get stack allocation and stack deallocation and that's it.

Why would compiller give an error? That's a valid program.

This code does compile and generates an exe file...When I went thru disassembly, I found nothing useful in it...There were no nops in it. First of all our basic coding principles say that it should give a compiler error... compilers like msvc, gcc simply pass without giving any error or warnings..

<gcc simply pass without giving errors or warnings
Well there are warnings. Try to copile like this gcc var.c -o var -Wall <When I went thru disassembly, I found nothing useful in it
ofcourse that's exactly what warnings try to tell

var.c: In function `main':
var.c:6: warning: left-hand operand of comma expression has no effect
var.c:8: warning: left-hand operand of comma expression has no effect
var.c:8: warning: left-hand operand of comma expression has no effect
var.c:6: warning: statement with no effect
var.c:7: warning: statement with no effect
var.c:8: warning: statement with no effect
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.