Re: If you could change the C or C++ or Java syntax, what would you like different?

Felix Palmen wrote:
* Jon <jomar@xxxxxxxxxxxxx>:
Felix Palmen wrote:
* Ian Collins <ian-news@xxxxxxxxxxx>:
Maybe "at the point of first use (which happens to be the point of
initialisation)" would have been clearer?

Which would be -- in the general case of first using them somewhere
in the middle of a scope block -- illegal in C89.

In fact, I like this C89 restriction.

What about loop vars? Same thing?

for (int i = 0; i < 100; i++)
// blah with i

Isn't that effectively the same as "in the middle of a scope"?



a loop is its own scope

Hello, duh.

where the block delimeters /can/ be
omitted for a single-statement body

Advanced topics in language implementation and compiler design then, yes?

(but this is often discouraged in
coding conventions).

"they" are wrong and *I* am right on this one (it's worth it):


if (i_rock)


Nuff said?

------ (now about this ugly comnent syntax...)


Relevant Pages

  • Re: Conformance
    ... scope the initialisation of the T array is still legal C (because it ... Also likely to lead to confusion when people get a diagnostic for simply declaring a variable. ...
  • Re: Conformance
    ... opinion is that it should call the overloaded operator. ... at file and at function scope since, at file scope, you want to keep the ... scope the initialisation of the T array is still legal C (because it ...
  • Re: Conformance
    ... wanted to know which way you were planning to resolve it. ... scope the initialisation of the T array is still legal C (because it ...
  • Re: Iterating over an array style question
    ... BufferedReader rdr = ...; ... clearer is not necessarily better. ... variable line has a greatly expanded scope ... There are good reasons for following this principle. ...
  • Re: Is VB Caca??
    ... What does this have to do with punch cards? ... Dim x As Integer ... What you are talking about is implicit initialisation of local variables. ... I wouldn't use that in a deep scope anyway, as the variable is only initialised when the method starts, not at the line where you declare it. ...