Article:
  When Linux Runs Out of Memory
Subject:   Source needs some changes to compile
Date:   2006-11-30 18:26:14
From:   cdonges
if ! (myblock) break;


should be


if (! myblock) break;


and


print("Currently allocating %d MB\n", ++count);


should be


print f("Currently allocating %d MB\n", ++count);

Full Threads Newest First

Showing messages 1 through 5 of 5.

  • Source needs some changes to compile
    2006-12-01 03:50:13  mulyadi_santosa [View]

    Hi...

    Thank you for the clarification. However, IIRC, both !(myblock) or (!myblock) should yield same result. I am away from dedicated Linux box right now, but I'll confirm it ASAP.

    regards,

    Mulyadi
    • Source needs some changes to compile
      2006-12-01 07:55:22  nathan@nathanpowell.org [View]

      No the OP is right. IANACP but for it to compile with GCC 4.1.2 I had to make the same changes.
    • Source needs some changes to compile
      2007-06-21 16:33:31  deStilaDo [View]

      IAACP and no, it's wrong.
      Even if it's accepted by any compiler, it shouldn't.
      The grammar of the C language states that parenthesis are mandatory part of "if statement", formally know as "selection_statement":

      selection_statement: in statement
      IF '(' expression ')' statement
      | IF '(' expression ')' statement ELSE statement


      http://www.vendian.org/mncharity/ccode/grammar/html/degener_symb.txt.html#selection_statement


      • Source needs some changes to compile
        2007-07-04 09:29:25  mulyadi_santosa [View]

        another big thanks for pointing that out...

        regards,

        Mulyadi
  • Source needs some changes to compile
    2006-12-01 10:06:18  chromatic | O'Reilly AuthorO'Reilly Blogger [View]

    Thanks; I updated the article.