in reply to Re^3: Pearls (not really) of Perl programming
in thread Pearls (not really) of Perl programming
Close... VC++ .NET allows it, gcc 2.95.4 forbids it.
a.cpp
#include <stdio.h> int main() { for (int i=0; i<5; i++) { printf("%d\n", i); } printf("%d\n", i); return 0; }
VC++ .NET
>cl a.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for +80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. a.cpp Microsoft (R) Incremental Linker Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. /out:a.exe a.obj >a 0 1 2 3 4 5
gcc 2.95.4
$ gcc a.cpp -o a a.cpp: In function `int main()': a.cpp:9: name lookup of `i' changed for new ANSI `for' scoping a.cpp:5: using obsolete binding at `i'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Pearls (not really) of Perl programming
by Anonymous Monk on Nov 26, 2004 at 23:25 UTC |