Questions tagged [gcc]
GCC is the GNU Compiler Collection. It's the de facto standard compiler for C, C++, Go, Fortran, and Ada on Linux and supports many other languages and platforms as well.
41,807
questions
2
votes
3
answers
2k
views
How to send Email through a C++ program?
How can I send an email from C++? Is there a good cross-platform (MS Windows, Linux etc) library that I can use? I'm using GCC (cygwin on MS Windows).
2
votes
3
answers
2k
views
C++ tr1 on GCC 3.4.4 (for the Nokia N810 tablet computer)
What does it take to get C++ tr1 members (shared_ptr especially, but we'd like function and bind and ALL the others) working with GCC 3.4.4 (for the Nokia N810 tablet computer).
Has anyone done ...
18
votes
2
answers
18k
views
Link error when compiling gcc atomic operation in 32-bit mode
I have the following program:
~/test> cat test.cc
int main()
{
int i = 3;
int j = __sync_add_and_fetch(&i, 1);
return 0;
}
I'm compiling this program using GCC 4.2.2 on Linux running on ...
59
votes
7
answers
56k
views
GNU compiler warning "class has virtual functions but non-virtual destructor"
I have defined an interface in C++, i.e. a class containing only pure virtual functions.
I want to explicitly forbid users of the interface to delete the object through a pointer to the interface, so ...
25
votes
10
answers
14k
views
Is it possible to subclass a C struct in C++ and use pointers to the struct in C code?
Is there a side effect in doing this:
C code:
struct foo {
int k;
};
int ret_foo(const struct foo* f){
return f.k;
}
C++ code:
class bar : public foo {
int my_bar() {
...
12
votes
3
answers
3k
views
How to get GCC to use more than two SIMD registers when using intrinsics?
I am writing some code and trying to speed it up using SIMD intrinsics SSE2/3. My code is of such nature that I need to load some data into an XMM register and act on it many times. When I'm looking ...
3
votes
3
answers
2k
views
Performance improvements moving from g++/gcc 3.2.3 to 4.2.4
We have been looking at g++ versions 3.2.3 and 4.2.4. With 4.2.4, the performance improvements on some of our code base is significant.
I've tried searching the gcc buzilla database to find hints as ...
13
votes
4
answers
7k
views
GCC inline assembler, mixing register sizes (x86)
Does anyone know how I can get rid of the following assembler warning?
Code is x86, 32 bit:
int test (int x)
{
int y;
// do a bit-rotate by 8 on the lower word. leave upper word intact.
asm ("...
53
votes
7
answers
12k
views
Why doesn't GCC optimize structs?
Systems demand that certain primitives be aligned to certain points within the memory (ints to bytes that are multiples of 4, shorts to bytes that are multiples of 2, etc.). Of course, these can be ...
45
votes
10
answers
56k
views
Is there a way to install gcc in OSX without installing Xcode?
I've googled the hell out of it, and it seems like there is no way to install gcc on OS X without installing Xcode (which takes at leats 1.5GB of space). All I need is gcc and none of the other junk ...
0
votes
3
answers
2k
views
Which gcc switch disables "left-hand operand of comma has no effect" warning?
It's a part of larger code base, which forces -Werror on gcc. This warning is generated in a third party code that shouldn't be changed (and I actually know how to fix it), but I can disable specific ...
28
votes
9
answers
45k
views
GCC optimization flags for Intel Atom [closed]
I'm developing a performance critical application for Intel Atom processor.
What are the best gcc optimization flags for this CPU?
459
votes
10
answers
220k
views
How do the likely/unlikely macros in the Linux kernel work and what is their benefit?
I've been digging through some parts of the Linux kernel, and found calls like this:
if (unlikely(fd < 0))
{
/* Do something */
}
or
if (likely(!err))
{
/* Do something */
}
I've found ...
24
votes
11
answers
9k
views
How to simulate memory allocation errors
My C application uses 3rd libraries, which do their own memory management.
In order to be robust, my application has code to deal with failures of library functions due to lack of free memory.
I ...
9
votes
3
answers
11k
views
GCC compiling a dll with __stdcall
When we compile a dll using __stdcall inside visual studio 2008 the compiled function names inside the dll are.
FunctionName
Though when we compile the same dll using GCC using wx-dev-cpp GCC ...