0
(x = (*mat)++;)
If it is valid, explain to me why and how it will work.
0
(x = (*mat)++;)
If it is valid, explain to me why and how it will work.
3
That’s not valid, you can’t have one statement in parentheses. Why?
Because the language specification (old text, new ones are paid) says so. They could allow it, but there is no advantage to it and eventually something could conflict with the evolution of language.
The idea is not to let do crazy things. Without the external parentheses and with the proper code around it would be valid. Anyway, analyzing an isolated code like that makes little sense.
When you want to know if something is valid, write to a file and see if the compiler accepts.
Thanks, it’s pretty clear now!
@Jrfelix take a look at the [tour] to see how best to thank.
Vc posted a specification of almost 1400 pages. Where it says that this is invalid?
@God knows, but if the compilers invalidate this must be in the specification, after all what is not in it has no reason to do something like this in the compiler :)
@Amadeus chapter 6 gives the grammar of statements. I do not remember in any other corner where it is specified the possibility of having ;
Browser other questions tagged c++ pointer syntax
You are not signed in. Login or sign up in order to post.
This referring to the point and comma (
;
)?– Guilherme Nascimento
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero