TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARIN MCBRIDE
from: MATHIEU BOUCHARD
date: 1997-09-06 21:21:00
subject: Why the braces?

 NH>>> switch (foo) {
 NH>>> case 1 :
 NH>>> int bar = 2;
 NH>>> break;
 NH>>> case 2 :
 NH>>> int bar = 3;
 NH>>> break;
 NH>>> }
 MB>> in C/C++, lack of initialization is not an error. the error is that
 MB>> there are two identical variable names.
 DM> Nope... both are errors.  Have you tried it on your compiler before 
 DM> posting, or did you just post?  Try compiling an example, first...
Using TC++ 3.00,
Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
z.cpp:
Error z.cpp 7: Multiple declaration for 'patate' in function main(int)
Warning z.cpp 9: 'patate' is assigned a value that is never used in
function mai
n(int)
*** 1 errors in Compile ***
that's all.
(the warning is irrelevant to our problem here)
only 1 error. i'll try it in GCC in a few minutes..
matju
--- Terminate 4.00/Pro
---------------
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.