www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/03/05:45:51

Message-ID: <396050CE.ECE36EF7@earthlink.net>
From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Organization: Nocturnal Aviation
X-Mailer: Mozilla 4.73 [en] (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: syntax E?r?r?o?r?
References: <go9tls4tdiruq2kv68c5m6f0otoerndr1a AT 4ax DOT com> <ohnvlskl8vhi21rafs0pbse2q2do79aehs AT 4ax DOT com>
Lines: 72
Date: Mon, 03 Jul 2000 08:36:10 GMT
NNTP-Posting-Host: 63.23.134.233
X-Complaints-To: abuse AT earthlink DOT net
X-Trace: newsread2.prod.itd.earthlink.net 962613370 63.23.134.233 (Mon, 03 Jul 2000 01:36:10 PDT)
NNTP-Posting-Date: Mon, 03 Jul 2000 01:36:10 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019