| PLEX86 | ||
Where should the type information be 145Stephen, et al,
I may have misled people a bit when I pointed out that the precedence tables in C were wrong (which they are). Where should the type information be 147 This is a feature with C, not a bug. In C, just as with many buttemblers, and, or, xor and not are used in... The very existence of precedence tables indicate a deeper problem. The deeper problem is that the expression parser fails-refuses to type the subexpressions, which is little wonder when you consider that C is missing some crucial subtypes, most especially boolean. To illustrate, the result of a comparison should be a boolean. Operations between booleans should produce another boolean. Arithmetic operations on booleans should produce an error (unless cast as a suitable arithmetic type), as should boolean operations on arithmetic types (unless cast as boolean). If C had a boolean type and had an expression parser that paid attention to the types of subexpressions, then the whole discussion regarding precedence tables would be moot. Once this has been done, then the follow who posted that code should not depend on precedence is absolutely right. Who knows or cares whether ANDs or ORs have precedence (of course I could look it up). If the programmer hasn't included parentheses, then it is IMPOSSIBLE to know his intentions, whether or not the code actually runs. This is an INTOLERABLE defect. Such code should be flagged as being too poor to depend on, whether or not it runs. Where should the type information be 146 On Tue, 29 Mar 2005 18:03:27 -0700 in alt.folklore.computers, Steve Precedence tables are merely a summary of the grammatical rules which specify the operator precedence: no such tables... In short, any language where it is possible to write anything resembling "The C Problem Book" obviously needs serious repair. Steve Richfie1d
|
||||
Where should the type information be 146 Alt Folklore Computers from Newsgroups The #1 Usenet Provider on the Internet
|
||||