February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin M. Pedersen | land = logical and lor = logical or leq = logical equal & = binary and | = binary or = = binary equal >> = logical shift right << = logical shift left o> = Roll Right o< = Roll Left do ch = fgetc(fp) if (ch != EOF land ch != EOL) then exit ... loop > I don't agree with you one this. Consider this C/C++ example: > > while ( ch=fgetc(fp), ch!=EOF && ch!='\n' ) { > ... > } > > without the assignment it might become: > > for (;;) { > ch = fgetc(fp); > if (ch==EOF || ch=='\n') { > break; > } > ... > } > > and the condition is moved into the loop, which I prefer to avoid if there is a simple solution to it. > > The for-construction above isn't valid D code according to the specs, because the increment cannot be omitted in D. Anyway, I prefer for(;;) over > while(true) as the latter might lead to warnings about constant conditionals > (such warnings are often very useful). For this reason I would like to see some construction that allows an "indefinite" loop without constant expressions. It might be for(;;), but a "forever" loop construction would please me just as much. > > Regards, > Martin > > > > > > > > > > |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | C syntax is a fine model to follow if you wish to continually repeat the same perpetually exposed errors. I recommend avoiding errors. Use ";" optionally. EOL = ";" unless prefixed with a line continuation token. Pavel Minayev <evilone@omen.ru> wrote in message news:a3c1ts$2hln$1@digitaldaemon.com... > "Keith Nash" <k.j.nash@usa.net> wrote in message news:a39e2f$2gk9$1@digitaldaemon.com... > We C guys have all got so used to it, I don't think it's a good idea to drop this syntax... |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to D | "D" <s_nudds@hotmail.com> wrote in message news:a3lf84$pao$1@digitaldaemon.com... > Semicolons aren't redundant in C/C++ whitespace and <EOL> are ignored. As a > result semicolons are considered <EOL>. There is no significant problems caused by considering the real <EOL> to be equivalent to a semicolon with the exception that you lose the ability to spread single statments over multiple lines. To that end, you have to define another symbol as a line continuation symbol. When this symbol is encountered, the next true <EOL> is ignored. > > It's as simple as that. Not really. Some languages (Euphoria, Lua - those I know well) don't use statement delimiters at all. You can write: if a = 1 then a += 1 end -- or -- if a = 1 then a += 1 end -- or even -- if a = 1 then a += 1 end Still, I prefer to have semicolons. They make life easier when reading code, and help compiler to parse some complicated cases. |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to D | "D" <s_nudds@hotmail.com> wrote in message news:a3lfdg$php$1@digitaldaemon.com... > With respect to boolean types, it is essential that the language have predefined constants for true and false. D has both. true is 0, false is 1. Both are of type bit. |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to D | "D" <s_nudds@hotmail.com> wrote in message news:a3lgkl$qpp$1@digitaldaemon.com... > land = logical and > lor = logical or > leq = logical equal Why not then simply "and" & "or" & "eq", and where is "not"?. And why don't you like && || ? > >> = logical shift right > << = logical shift left LOGICAL SHIFT??? > do > ch = fgetc(fp) > if (ch != EOF land ch != EOL) then exit > ... > loop No Pascal, please =) while (true) { ... } |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to D | "D" <s_nudds@hotmail.com> wrote in message news:a3lh1c$qtg$1@digitaldaemon.com... > C syntax is a fine model to follow if you wish to continually repeat the same perpetually exposed errors. > > I recommend avoiding errors. > > Use ";" optionally. EOL = ";" unless prefixed with a line continuation token. BASIC fan, eh? =) Just indent code properly, and everything is very readable. In fact, C/C++/D code is sometimes more readable than BASIC or Pascal one, because you read much less junk. |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Bober | "Brian Bober" <netdemonz@yahoo.com> wrote in message news:a3lcbu$mp5$1@digitaldaemon.com... > What I would like to see is an > ability to do multi-line strings. char[] s = "first line\n" "second line\n" "third line\n" ... ; > How about a warning or error if two statements are on the same line? This is the same as defining EOL as end-of-statement. And I won't be able to write something like this? a++; b++; c = a + b; Never ever! =) |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to D | Sounds like a PITA... not a good tradeoff. Sean "D" <s_nudds@hotmail.com> wrote in message news:a3lf84$pao$1@digitaldaemon.com... > Semicolons aren't redundant in C/C++ whitespace and <EOL> are ignored. As a > result semicolons are considered <EOL>. There is no significant problems caused by considering the real <EOL> to be equivalent to a semicolon with the exception that you lose the ability to spread single statments over multiple lines. To that end, you have to define another symbol as a line continuation symbol. When this symbol is encountered, the next true <EOL> is ignored. > > It's as simple as that. > > > > Javascript has optional semicolons. It sounds like a good idea, but in practice it causes a lot of subtle problems with the parser. Some level of > > redundancy is necessary in a useful language, because it enables the compilers to detect errors. No redundancy means that any stream of random > > tty noise is a valid program. Requiring semicolons in C enables more typo > > errors to be diagnosed at compile time rather than at debug time. Too much > > redundancy, however, makes a language just annoying to program in <g>. |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to D | Yeah, we've heard you already. Sean "D" <s_nudds@hotmail.com> wrote in message news:a3lh1c$qtg$1@digitaldaemon.com... > C syntax is a fine model to follow if you wish to continually repeat the same perpetually exposed errors. > > I recommend avoiding errors. > > Use ";" optionally. EOL = ";" unless prefixed with a line continuation token. > > Pavel Minayev <evilone@omen.ru> wrote in message news:a3c1ts$2hln$1@digitaldaemon.com... > > "Keith Nash" <k.j.nash@usa.net> wrote in message news:a39e2f$2gk9$1@digitaldaemon.com... > > > We C guys have all got so used to it, I don't think it's a good idea to drop this syntax... |
February 04, 2002 Re: More C/C++ Features to Drop | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Pavel Minayev wrote: > "D" <s_nudds@hotmail.com> wrote in message > news:a3lgkl$qpp$1@digitaldaemon.com... >> >> = logical shift right >> >> << = logical shift left >> > > LOGICAL SHIFT??? Logical shift = unsigned shift = not arithmetic shift = don't shift in sign bits. Doesn't make a difference to the left shift, obviously. |
Copyright © 1999-2021 by the D Language Foundation