From: brarcher Date: Tue, 4 Feb 2014 00:36:04 +0000 (+0000) Subject: example: MSVC wants the var decl at the top X-Git-Tag: 0.10.0~126 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03e5ff524a6faeac1fb701829740c403ad7e9688;p=check example: MSVC wants the var decl at the top git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1091 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- diff --git a/doc/example/src/money.6.c b/doc/example/src/money.6.c index 111e611..e020e9e 100644 --- a/doc/example/src/money.6.c +++ b/doc/example/src/money.6.c @@ -9,12 +9,14 @@ struct Money Money *money_create(int amount, char *currency) { + Money *m; + if (amount < 0) { return NULL; } - Money *m = malloc(sizeof(Money)); + m = malloc(sizeof(Money)); if (m == NULL) { diff --git a/doc/example/src/money.c b/doc/example/src/money.c index 111e611..e020e9e 100644 --- a/doc/example/src/money.c +++ b/doc/example/src/money.c @@ -9,12 +9,14 @@ struct Money Money *money_create(int amount, char *currency) { + Money *m; + if (amount < 0) { return NULL; } - Money *m = malloc(sizeof(Money)); + m = malloc(sizeof(Money)); if (m == NULL) {