I have never seen __attribute__ in a c or .h file, is this in a program ? or is this in the standard gcc header files ? If its in a program, look into the code, and check.
: Does anybody know what the __attribute__ in certain .c and .h files in Linux means? : Know where I can get additional info? : : Thanks, : Deepak :
: I have never seen __attribute__ in a c or .h file, is this in a program ? or is this in the standard gcc header files ? If its in a program, look into the code, and check. : : : Does anybody know what the __attribute__ in certain .c and .h files in Linux means? : : Know where I can get additional info? : : : : Thanks, : : Deepak : : : :
Do a grep for __attribute__ in the source files of Linux components.
: : I have never seen __attribute__ in a c or .h file, is this in a program ? or is this in the standard gcc header files ? If its in a program, look into the code, and check. : : : : : Does anybody know what the __attribute__ in certain .c and .h files in Linux means? : : : Know where I can get additional info? : : : : : : Thanks, : : : Deepak : : : : : : : : : Do a grep for __attribute__ in the source files of Linux components. : : D : :
Actually I was searching for this sort of stuff for my code in C, and was wondering what the option was for compiling in 1byte boundary.
: : : I have never seen __attribute__ in a c or .h file, is this in a program ? or is this in the standard gcc header files ? If its in a program, look into the code, and check. : : : : : : : Does anybody know what the __attribute__ in certain .c and .h files in Linux means? : : : : Know where I can get additional info? : : : : : : : : Thanks, : : : : Deepak : : : : : : : : : : : : : : Do a grep for __attribute__ in the source files of Linux components. : : : : D : : : : : : Check out http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC84 : : D : :
sizeof(Packaging) will be 5 Bytes because of aliasing. [/code] We can use __attribute__ instead of #pragma, like this: [code] struct Packaging { char c; int i; } __attribute__((packed)) Packaging; [/code] It will have the same effect as pragma. And there are a lot of other uses for __attribute__.
Comments
: Does anybody know what the __attribute__ in certain .c and .h files in Linux means?
: Know where I can get additional info?
:
: Thanks,
: Deepak
:
:
: : Does anybody know what the __attribute__ in certain .c and .h files in Linux means?
: : Know where I can get additional info?
: :
: : Thanks,
: : Deepak
: :
:
:
Do a grep for __attribute__ in the source files of Linux components.
D
: :
: : : Does anybody know what the __attribute__ in certain .c and .h files in Linux means?
: : : Know where I can get additional info?
: : :
: : : Thanks,
: : : Deepak
: : :
: :
: :
:
: Do a grep for __attribute__ in the source files of Linux components.
:
: D
:
:
Check out http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC84
D
Actually I was searching for this sort of stuff for my code in C, and was wondering what the option was for compiling in 1byte boundary.
: : : I have never seen __attribute__ in a c or .h file, is this in a program ? or is this in the standard gcc header files ? If its in a program, look into the code, and check.
: : :
: : : : Does anybody know what the __attribute__ in certain .c and .h files in Linux means?
: : : : Know where I can get additional info?
: : : :
: : : : Thanks,
: : : : Deepak
: : : :
: : :
: : :
: :
: : Do a grep for __attribute__ in the source files of Linux components.
: :
: : D
: :
: :
:
: Check out http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC84
:
: D
:
:
: Know where I can get additional info?
It is quite easy: info gcc.
The keyword __attribute__ ((lalala)) tells gcc,
that function is not just a common function. It can make
many different things with it, due the lalala.
Read the section "C extensions"->"Function attributes"
Take for example this code:
[code]
struct Packaging {
char c;
int i;
} Packaging;
sizeof(Packaging) will be 8 Bytes.
[/code]
or you could do:
[code]
#pragma pack(push)
#pragma pack(1)
struct Packaging {
char c;
int i;
} Packaging;
#pragma pack(pop)
sizeof(Packaging) will be 5 Bytes because of aliasing.
[/code]
We can use __attribute__ instead of #pragma, like this:
[code]
struct Packaging {
char c;
int i;
} __attribute__((packed)) Packaging;
[/code]
It will have the same effect as pragma.
And there are a lot of other uses for __attribute__.
I have just noticed that all my files have the attribute C. I've been running XP on the machine for several years, and I never noticed that before.
[link=http://www.hyphentechnologies.in/website-designing.php]Website Design Company[/link] | [link=http://www.hyphentechnologies.in/graphic-designing.php]Graphics Design Services[/link]
I have just noticed that all my files have the attribute C. I've been running XP on the machine for several years, and I never noticed that before.