Topic: With Void Expressions, All are expressions, Another Fantasy!
Author: tinct@163.com (Tinct)
Date: Wed, 26 Sep 2001 14:43:23 GMT Raw View
In this fantasyland, almost every thing is expression with
void(zero-size type) support.
"3+5" and "sin(x)" are expressions, while "sin(x);" is statement. If
we treat statements as general void expressions, C++ program would
consists of a uniform series of expressions. Semicolon now means to
convert expression ahead to void, i.e., to ignore its value.
E.g.
() :void expression
( i=3; j=5; if(k>2)x++; foo(y); ) :void expression
( i=3; do{x++;}while(x<0); sqrt(4.0) ) :expression, last value is
(double)2.0
for(;;){} :here, void is treated as
true :-)
There must be many quesions about it. But it is really fancy and
uniform.
Also it is realizable.
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: Ron Natalie <ron@sensor.com>
Date: Wed, 26 Sep 2001 22:52:53 GMT Raw View
Tinct wrote:
>
> In this fantasyland, almost every thing is expression with
> void(zero-size type) support.
> "3+5" and "sin(x)" are expressions, while "sin(x);" is statement. If
> we treat statements as general void expressions, C++ program would
> consists of a uniform series of expressions. Semicolon now means to
> convert expression ahead to void, i.e., to ignore its value.
How is this the least bit useful?
What are you going to do with declarations?
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]