gcc-extensions Questions

2

Solved

Can somebody tell me the difference between #pragma pack(push,1) and __attribute__((packed))? I am getting a compilation error if I use second type of struct packing which says cannot bind packe...
Elmiraelmo asked 26/11, 2018 at 12:58

3

Solved

I'm trying to work through an issue on a third party library. The issue is the library uses GCC's nested functions buried in a macro, and Clang does not support nested functions and has no plans to...
Ishtar asked 25/7, 2014 at 15:38

2

Solved

I had always thought that variable length arrays were not allowed in c++(Refer :Why aren't variable-length arrays part of the C++ standard?) .But than why does this code compile and work? #inc...
Committee asked 25/2, 2014 at 11:55

1

Solved

Refering to js0n.c The code syntax is as below: static void *gostruct[] = { [0 ... 255] = &&l_bad, ['\t'] = &&l_loop, [' '] = &&l_loop, ['\r'] = &&l_loop, ['\n...
Etamine asked 22/5, 2015 at 4:51

2

Solved

During my C language practice, I face an expression and then I get it simplified as follows: int a=({10;}); It is a legal expression since it gets past the gcc compiler. Please focus on this pa...
Outlying asked 16/10, 2013 at 3:27

4

Solved

Here is a piece of code in /usr/src/linux-3.10.10-1-ARCH/include/linux/printk.h: static inline int printk_get_level(const char *buffer) { if (buffer[0] == KERN_SOH_ASCII && buffer[1]) { ...
Limelight asked 17/9, 2013 at 15:10

3

I'm reading about VLAs in C Primer Plus, and this book strictly says that the introduction of VLAs to C began with the C99 standard. Whenever I attempt to declare a loop control variable within the...
Gatto asked 15/7, 2013 at 12:39

1

Solved

GCC has an awesome ternary expression extension to C which allows us to create a statement like this: int x = some_var ?: 10; // expands to some_var ? some_var : 10 Which is really nice, and whi...
Puff asked 4/6, 2013 at 18:57

2

Solved

I don't understand why this works: /* gcc range extension */ __extension__ static int fn(int n) { switch (n) { case 0: return 0; case 1 ... 1000: return 1; default: return -1; } } But this ...
Bick asked 17/1, 2013 at 12:6

1

Solved

I'm writing some code that makes use of computed goto. The syntax checker is flagging every instance of goto *ptr and &&label as syntax error. Is there anyway to stop this? Addition by alk...
Pilau asked 20/9, 2012 at 10:1

4

Solved

I came across this weird C++ program. #include <iostream> using namespace std; int main() { int a = ({int x; cin >> x; x;}); cout << a; } Can anyone explain what is going on?...
1

© 2022 - 2024 — McMap. All rights reserved.