GCC provides extensions not found in ISO standard C or C++.
Questions tagged [gcc-extensions]
45 questions
1
vote
1 answer
In G++ 4.8, typeof still cannot be used with "::"
The following code does not compile under G++ 4.8
#include
using namespace std;
int main() {
vector v;
typeof(v)::iterator it;
}
If I replace typeof to decltype, it works fine. I know about a workaround with a template…

user31264
- 6,557
- 3
- 26
- 40
0
votes
2 answers
Does using range in Switch-case increases compilation time compared to if-else
int main()
{
int year;
cin>>year;
switch (year)
{
case 1000 ... 1500:
cout<<"less than 1501";
break;
case 1502 ... 2500:
cout<<"greater than 1501";
…

Utkarsh Bhaskar
- 17
- 1
0
votes
1 answer
GCC: blocks in assignments with return values making macros easier?
I vaguely recall that GCC had an extension letting you write something like:
total += { if ( b == answerb ) {
printf( "b = %d (correct)\n", b );
return 1;
} else {
printf( "b = %d (incorrect,…

Swiss Frank
- 1,985
- 15
- 33
0
votes
0 answers
GCC language extension __attribute__((vector_size(16))) incompatible type error
While using Csmith a random C program generator I tried adding a GNU C language variable extension attribute((vector_size(16))) for variable .
static uint64_t func_1(void)
{/* block id: 0 */
uint64_t l_6 __attribute__ ((vector_size (64))) =…

Sameeran Joshi
- 59
- 1
- 10
0
votes
0 answers
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘g_11’ while using a GNU complex extension
I know there are many similar questions to above question, but I am facing error while adding a GNU complex extension to the simple code base near the global variable declared.
/*
* This is a RANDOMLY GENERATED PROGRAM.
*
*…

Sameeran Joshi
- 59
- 1
- 10
0
votes
1 answer
What rules of C++11 standard are used to determine the type of the expression in ({ ... })
I hasn't understand what compiler does here and why it's working c++ code
#include
int main()
{
printf( ({ // (1)
struct some_noize_struct {
// there may be another code
};
…

user3273943
- 13
- 3
0
votes
0 answers
Unexpected Result of GNU order-statistics-tree
I have just learned something about GNU Policy-Based Data Structures. But I got some unexpected result on this question: (the original version is described in Chinese, so I've translated it.)
You need to write a data structure which support…

con ko
- 1,368
- 5
- 18
0
votes
1 answer
What ARM compiler version is needed for attribute(noinline) support?
I'm not sure how to find out what version of ARM compiler(armcc) is required for any given attribute to be supported.
For example __atribute__((noinline))?
See
http://www.keil.com/support/man/docs/armcc/armcc_chr1359124975804.htm

Djordje Zivanovic
- 185
- 4
- 11
0
votes
2 answers
ASM Inline call C external function
I'm trying to call an external function in c by an asm inline with a branch. I'm compiling to an arm m0 instruction set but it returns bad expression.
The code is:
__asm volatile (
" cmp r3,#0 \n" …

Geancarlo Abich
- 7
- 1
- 2
0
votes
2 answers
How to use Arduino with Microsoft Visual Studio ( Due to #include_next precompiler issues)
In short,
I need to do this,
#include_next
however Visual Studio doesn't like this and complains,
Error 40 error C1021: invalid preprocessor command 'include_next' c:\program files…

SeahawksRdaBest
- 868
- 5
- 17
0
votes
1 answer
Use gcc extensions on codeblocks windows
I want to know if its possible to use gcc extensions in codeblocks like typeof in the windows environment.
The code below is meant just to show an example of how I want to use typeof.
#include
#include
#define SWAP(x, y) do {…

Mansueli
- 6,223
- 8
- 33
- 57
-1
votes
2 answers
What is __attribute__ vector_size?
Given this code:
using vec = uint32_t __attribute__ ((vector_size (16)));
How can it be rewritten for MSVC 2015?

vladon
- 8,158
- 2
- 47
- 91
-3
votes
2 answers
Unable to understand following function declaration
Can anybody explain following function declaration.
inline uint64_t MY_FUNC(unsigned long param) __attribute__ ((pure, always_inline));

Chinna
- 3,930
- 4
- 25
- 55
-5
votes
2 answers
Simple c++ program gets compilation errors
When I'm trying to compile this code, it shows error:
main.cpp:19:3: error: invalid operands of types 'void' and 'int' to binary 'operator!='
This is the file:
#include
#include
using namespace std;
#define $ DEBUG
#define DEBUG…

Daniel
- 197
- 2
- 16
-27
votes
2 answers
GCC - modify where execution continues after function return
Is it possible to do something like this in GCC?
void foo() {
if (something()) returnSomewhereElse;
else return;
}
void bar() {
foo();
return; // something failed, no point of continuing
somewhereElse:
// execution resumes…

IvanB
- 115
- 8