Re: Declaring variables in "case" blocks?



Robbie Hatley wrote, On 31/07/07 21:20:
"Keith Thompson" <kst-u@xxxxxxx> wrote:

"Robbie Hatley" <see.my.signature@xxxxxxxxxxxxxxxxxxxx> writes:

<snip>

You'd have been better off posting a small compilable program,
so you could confirm that the problem is still there.

I (mostly) did. If you #define WHATEVER, then call Function()
from main(), it will compile and run.

Hmmm... let me try that.

Ok, I just compiled and ran my stripped-down version here,
with a sprintf() of DumVar to a char buffer, and printed the buffer
in a popup message box. It displays as "72". Oops. Problem went
away. Weird.

<snip>

This is why you should always reduce your code to a small compilable example that exhibits the problem (obviously, if the problem is it not compiling then it does not need to be compilable!). There is no point other people trying to debug a problem in code that does not exhibit the problem.
--
Flash Gordon
.



Relevant Pages

  • Re: error: expected ) before * token -- What is this ?
    ... No - they are part of a specific package. ... Find out the definition for all the SPF_*_types in the function declaration ... Do you compile in ISO C ... Try to compile a minimal program that still exhibits ...
    (comp.lang.c)
  • Re: help with C
    ... sulays wrote: ... Post something that I can compile. ... create a smaller version that exhibits the same problem. ... Prev by Date: ...
    (comp.lang.c)
  • Re: binary open mode
    ... > but when i compile the code, gpp prints: ... Did you include all the necessary headers? ... code that exhibits the error, and not just one line like you did. ...
    (comp.lang.cpp)
  • Re: Why this program is crashing ???
    ... Show as a compilable minimum C program that ... exhibits whatever problem you have. ... compile as a separate compilation unit to be later linked into a proper ...
    (comp.lang.c)
  • Re: Dimension attribute based on host-associated variable - bug in Intel Fortran
    ... Rich Townsend schreef: ... Hmmm, I can compile this program too, without problem. ... message is triggered by the use of COUNTin an automatic array declaration, ...
    (comp.lang.fortran)