Mail Archives: djgpp/2000/07/03/05:45:51
Radical NetSurfer wrote:
>
> Lets see if I have this right:
>
> It is _NOT_ possible to _mix_ code and declarations,
> (or at least as indicated in my original example) ?!?
> Hmm... this is news to me, and sounds like that would
> break a whole lot of code thats out there.
No existing legal code would be broken. C programmers have
been aware of this restriction for well over a decade.
>
> 2nd: I suppose I should remember that not everybody would
> of recognized that I had enough foresight to have actually
> of had <time.h> and the Rseed declaration as well, and the rest in
> the ACTUAL program.... (sheesh people!)
Sheesh! We see far too many programs that do not work because of missing
headers. Since the standard practice is to give a short but complete piece of
code illustrating your problem, you have essentially
already claimed that the headers are not included. Further, there is
no way for anyone to guess what declaration you hallucinated for the
variable Rseed. If you post broken code, it is treated as broken.
>
> 3rd: What I am amazed at was that GCC was giving me a
> "parse error ... trnd...", which technically seemed silly.
> and ONLY after adding additional declarations (oh yeah,
> the actual clincher: a statment thats more "code-like" than
> declaration)... should of seen that myself.
>
> I am aware that declaring variables thus:
> for (int i=0; i<1000; ++i ) { }
> used to be considered perfectly acceptable,
> also interspersing declarations and "code" perse,
> is tolerable under certain conditions.
This is the _only_ C++-like content in your code. It is illegal C. When you
say "gcc" without adornment, the assumption must be C. You would not be so
clueless as to not tell us if you were using g++, would you? Just be glad no
one decided to treat you code in an unspecified language as Fortran, Pascal,
LISP, or Smalltalk.
>
> BOTTOM LINE: GCC only seems to complain at certain times,
> and not others... try it sometime with my original example.
> [or yeah, for those who aren't intuitive to have know, remember
> the <time.h>, Rseed, etc etc stuff..ok?]
Post a real example of the situation you describe instead of expecting
us to complete your code. Exactly how did you expect anyone to test
for the problem you suggest? Your complaint is entirely unfounded on the
basis of the evidence you have produced.
>
> I wasn't trying other compilers; I was concerned with DJGPP's
> reaction at the time.
It reacts badly to your errors. So do other compilers.
--
Martin Ambuhl mambuhl AT earthlink DOT net
What one knows is, in youth, of little moment; they know enough who
know how to learn. - Henry Adams
A thick skin is a gift from God. - Konrad Adenauer
- Raw text -