Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

-1
votes
0answers
37 views

How to ensure scheduling errors don't happen in superscalar chips [migrated]

I like to wrap my asm in C subroutines. Like this: void foo() { __asm__("op R0, R1"); ... __asm__("op R1, R4"); /* last instruction */ } When I do this I sometimes get scheduling ...
3
votes
2answers
317 views

How to avoid long call chains?

I have a hierarchy of objects, mostly connected by composition. I.e. (not showing the class methods for readability): class A {} class B {A a;} class C {B b;} etc... class Z {Y y;} class Z provides ...
-3
votes
1answer
99 views

Illustrate Meaning of : gcc -g programName.c

To debug a C program using gdb effectively it is required to compile it first using the command: gcc -g programName.c otherwise on using simply gcc programName.c and running we are unable to ...
2
votes
2answers
123 views

In which stage of compilation is “typedef” resolved by the compiler?

There are different stages of compilation Such as Preprocessing stage Syntax analysis Semantic analysis Intermediate Code generation Machine Code generation Optimization Linking My question here ...
0
votes
1answer
59 views

Macro guard in Objective-C

I have noticed that many famous libraries written in Objective-C (eg. AFNetworking) use the macro guard inside their header files. Im aware that the #import directive, which works exactly like ...
5
votes
2answers
428 views

Larger Code is Still Faster

When compiling C code with gcc, there are compiler optimizations, some that limit code size and others create fast code. From the -S flag, I see that the -O2/03 generates more assembly than the -Os ...
1
vote
1answer
483 views

register variable in C and C++

I know the concept of register variable and it's use cases but there are few questions in my mind based on what I have tried. I cannot access the address of a register variable in C though I can do ...
31
votes
3answers
7k views

Is GCC dying without threads support on Windows?

I need some opinion. GCC was always a very good compiler, but recently it is losing "appeal". I have just found that on Windows GCC does not have std::thread support, forcing Windows users to use ...
7
votes
3answers
293 views

Is there a way to use gcc as a library?

Anyone knows a solution that works something like this: #include <stdio.h> #include <gcc.h> /* This .h is what I'm looking for. */ int main (void) { /* variables declaration (...) */ ...
3
votes
2answers
462 views

How do .so files avoid problems associated with passing header-only templates like MS dll files have?

Based on the discussion around this question. I'd like to know how .so files/the ELF format/the gcc toolchain avoid problems passing classes defined purely in header files (like the std library). ...
7
votes
2answers
1k views

Questions about linking libraries in C

I am learning C (still very much a beginner) on Linux using the GCC compiler. I have noticed that some libraries, such as the library used with the math.h header, need to be linked in manually when ...
23
votes
5answers
31k views

How to write a very basic compiler

Advanced compilers like gcc compile codes into machine readable files according to the language in which the code has been written (e.g. C, C++, etc). In fact, they interpret the meaning of each codes ...
6
votes
2answers
882 views

Need help eliminating dead code paths and variables from C source code

I have a legacy C code on my hands, and I am given the task to filter dead/unused symbols and paths from it. Over the time there were many insertions and deletions, causing lots of unused symbols. I ...
1
vote
2answers
339 views

GCC: assembly listing for IA64 without an Itanium machine

I need to try the following thing: I would like to compile some simple C code samples and see the assembly listing generated by GCC for IA64 architecture, i.e. I just want to run GCC with the -S ...
6
votes
3answers
580 views

Does using GCC specific builtins qualify as incorporation within a project?

I understand that linking to a program licensed under the GPL requires that you release the source of your program under the GPL as well, while the LGPL does not require this. The terminology of the ...
5
votes
3answers
3k views

Whether to use -pedantic flag in g++ or not?

I'm learning C++ and I'm using g++ on Linux for practicing. I want to know if people working as programmers use g++ -pedantic flag and also its importance in real world. What about other compilers, ...
16
votes
4answers
2k views

GCC vs clang/LLVM — pros and cons of each [closed]

What are the pros and cons of GCC vs clang/LLVM?