jw wrote:
Dietmar Kuehl wrote: jw wrote:
[...] > void main()
> {
[...] > }
it is not a homework am on holiday and studying c++,this code gives 8
as a result but i think it must give 2 i couldnt understand this
Maybe you should start of studying English first: the above is not
proper sentence. Of course, it doesn't claim to be as all periods
are absent. Second, note that I haven't claimed that it is a
homework assignment. I claimed that your code or even the above
excerpt is illegal C++ which is backed up by basic.start.main
(3.6.1), paragraph 2, second sentence which reads:
It shall have a return type of type int, [...]
The "It" refers to "main()". The stuff following the comma is
irrelevant to the return type of 'main()'. Your turn!
Apparently, you are more interested in the effect of your macros
than the answer to your apparent question (well, strictly speaking
there was no question; I assumed you would be interested in the
output of the program and as I stated, the C++ standard makes no
statement about the output of this malformed program). With
respect to your macros, the actual answer is this: Why bother?
There are uses for macros in C++ but this is none of them. Use a
[n inline] function instead!
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence