Thread View: comp.std.c++
2 messages
2 total messages
Started by Ken Walter
Mon, 08 Apr 1996 12:27
Re: C++ syntactic trap
Author: Ken Walter
Date: Mon, 08 Apr 1996 12:27
Date: Mon, 08 Apr 1996 12:27
27 lines
1964 bytes
1964 bytes
In message <4k3q4p$lkd@syn.cs.cornell.edu> - vavasis@CS.Cornell.EDU (Stephen Va vasis) writes: [...] :>I would like to make a plea to the compiler-writers who read this :>group: please issue warnings for syntactic trouble spots! Implicit :>type conversion probably creates other traps that I haven't thought :>of. C++ programmers like me need help from the compiler to navigate :>the traps! :> [...] C and C++ are one of the worst syntacticly designed languages around. There is nothing to be done about it without severe redesign (a new language) The only one I can think of that is worse is PL/1 where amost anything you write has some meaning, just not necessarily what you expect. Maybe, as they keep adding features to fix something, the language will break from all the syntatic twisting and someone will define a new replacement language with a decent syntax covering all the concepts. (Algol 00 ?) --- [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Re: C++ syntactic trap
Author: Jerry Coffin
Date: Mon, 08 Apr 1996 19:20
Date: Mon, 08 Apr 1996 19:20
55 lines
3543 bytes
3543 bytes
In article <4kat8s$2i6k@news.gate.net>, solution@gate.net says...
[ ... ]
> C and C++ are one of the worst syntacticly designed languages around.
C and C++ - I believe that's two not one... <G> I tend to disagree as to the
meaning of your statement as well.
> There is nothing to be done about it without severe redesign (a new
> language) The only one I can think of that is worse is PL/1 where amost
> anything you write has some meaning, just not necessarily what you expect.
I'd have to guess that you've never used TECO then. Nor FORTRAN. For
instance, in parsing FORTAN, you have to deal with things like this:
do 10 i=1,10
vs.
do 10 i=1
The first is a do loop, the second a simple assignment of the value 1 to a
variable named `do 10 i'. There's no way to know for certain which you're
looking at until you find whether there's a comma after the `=', so you have
to either use a backtracking parser, or else several symbols of lookahead.
Worse, this not only has to be done in the parser, but in the lexer as well,
since it changes from having three tokens before the `=' to only one token.
In short, it's about as bad of syntax design as you can find. IMO, nothing in
either C or C++ even comes close.
> Maybe, as they keep adding features to fix something, the language will
> break from all the syntatic twisting and someone will define a new
> replacement language with a decent syntax covering all the concepts. (Algol
> 00 ?)
Hmm...how does one define when a language is "broken" ? C++ is certainly a
good deal harder to parse than C or something really simple like LISP, but is
still quite a bit easier than many others such as FORTRAN or PL/I. You
mentioned PL/I above, but may have failed to give a proper idea of how
difficult it really is to compile; though I suspect this has changed more
recently, at one time it was claimed that IBM's PL/I level F compiler
consisted of over 100 passes... (I don't know how much of this was due to
language complexity and how much to simply allow the compiler to run in
minimal memory though.) I'm not particuarly certain there's a direct
corollary between difficulty of implementation, and "brokeness", though it
seems likely that if a language is difficult to implement that individual
implementations are more likely to be broken. (Note that here I'm separating
between the language being broken and the implementation being broken.)
Later,
Jerry.
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads