Issue
I know GCC and probably Clang accept this syntax, but if I'm making games for the common 5 platforms (Mac, Windows, Linux, iOS, Android(Java)) but if I get C to run on Android probably by bridging Java and C, how portable is this? Should this be avoided?
I know that this is a bad funciton because simply return num*num;
is enough but this syntax, should I avoid it?
int square(int num) {
int x = ({
int y = num;
y*y;
});
return x;
}
Solution
This is not standard C. It's a GNU C extension called Statement Expressions. You should avoid it if you want maximum portability.
Answered By - Barmar Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.