Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiler support of GNU Statement Expression

Tags:

Which modern compilers support the Gnu Statement expression (C and C++ languages). What versions should I have to use a statement expressions?

Statement expression is smth like ({ code; code; retval }):

int b=56; int c=({int a; a=sin(b); a;}); 

I already know some such compilers:

  • GCC >=3
  • Clang/LLVM >= 3.0.0
  • Intel C++ Compiler >= 6.0 (Linux version, check page 4; bit limited)
  • Sun Studio >= 12 (New Language Extensions)
  • IBM XL for z/OS (marked as IBM extension)
  • Open64 (as it uses osprey-gcc frontend)

This compiler seems not to support this (i'm unsure):

  • MS Visual C++

PS. some C/C++ compilers are listed here but I interested only in mature compilers, that are used widely (e.g not a tcc or turbo c)

like image 587
osgx Avatar asked Jun 22 '11 12:06

osgx


2 Answers

The PathScale® EKOPath Compiler Suite

It support gnu99 with "−std=gnu99"

like image 132
plan9assembler Avatar answered Sep 20 '22 06:09

plan9assembler


The Intel C++ Compiler does not support statement expressions, even the last version that I know, version 13.0.

like image 37
lrineau Avatar answered Sep 18 '22 06:09

lrineau