Need help understanding this for loop code in C

后端 未结 5 1293
孤城傲影
孤城傲影 2021-01-11 17:22

Consider the following code in C:

void main()
{
    int a=0;

    for(printf(\"\\nA\"); a; printf(\"\\nB\"));

    printf(\"\\nC\");
    printf(\"\\nD\");            


        
5条回答
  •  灰色年华
    2021-01-11 17:58

    Turbo C++ 3.0 was release in the 1990's, and was very quickly followed up with a release of 3.1.

    I would guess that your ancient compiler had a number of bugs in it, which were updated quickly. In addition it might not have had such bugs, but may have emitted optimized assembly which fails under the new pipe lining architectures.

    In any event, it is guaranteed that Turbo C++ 3.0 is not supported on your current platform. When it comes to a compiler not being supported because the platform was created nearly 20 years later, you cannot really fault it for emitting the wrong program.

提交回复
热议问题