Questions tagged [gcc]
GCC is the GNU Compiler Collection. It's the de facto standard C compiler on Linux and supports many other languages and platforms as well.
42 questions
0
votes
0
answers
163
views
How To Share Code Between Assembly Files In A Modular Way
Recently, I started learning Arm64 assembly. The assembler I'm using is the GNU Assembler (GAS). The version of GAS I'm using is GNU assembler (GNU Binutils for Ubuntu) 2.42.
I want to make my code ...
-3
votes
1
answer
300
views
What does the filename "gmon.out" stand for?
The GNU compiler toolset has a profiler "gprof" for performance analysis of C++ programs. With the -pg switch, the gcc compiler will make executables that write a data file, "gmon.out&...
-2
votes
1
answer
1k
views
In C++ and GCC on Linux, is it possible to allocate memory to your swap space instead of your RAM?
I have a large hash, around 6 gigabytes that I load into memory. On my current laptop that I develop from, it really does a number on my system, causing massive amounts of lag while I try to go about ...
1
vote
2
answers
2k
views
Logically, is there a reason why ++i++ can not be a valid expression?
I had to increment my integer twice in a loop, so I thought I would try and be clever:
for (int i = 0; !sl.isEmpty(); ++i++) { ... }
++i++ however is not an assignable expression, at least in GCC.
...
8
votes
1
answer
16k
views
Difference between direct and indirect function() calls
I am curious about the Difference between direct and indirect function() calls
Could anyone help in the diff analysis ?
The c source code could be found at subroutine_direct.c and ...
1
vote
3
answers
3k
views
Does the gcc optimize out local arrays the same way it would optimize out a local variable?
If I write this code in a function:
void func(void)
{
int x = 0;
int y = 3724832+x;
}
It would (probably) optimize the variable y out because it isn't being used. Even if I'm wrong about this ...
2
votes
3
answers
3k
views
How to prevent 'global variables' in a big project?
With 'global variables', I mean
Variables on namespace level
Static data members in classes
Static variables in functions
In a big C++ project I would like to have a mechanism (like a compiler option) ...
3
votes
4
answers
3k
views
GCC or Clang to output bytecode for a VM?
Long story short, I wanted to use C as a scripting language and in a portable manner so I created a register-based, JITless VM to accomplish this.
I've formalized the VM's ISA, script file format, ...
0
votes
0
answers
143
views
Results of testing different compiler optimizations of GNU GCC are confusing
I tested out a few different compiler optimizations on GNU GCC, in the CodeBlocks IDE. With each different optimization I ran the same test: I let my program try to build as big of a tree as it could ...
0
votes
1
answer
125
views
When is it a good idea to test a build with both clang and gcc?
I am peeking through the code of torsocks where as you'll notice, the .travis.yml file instructs Travis CI to test against both clang and gcc.
compiler:
- clang
- gcc
I'm still learning and this ...
0
votes
0
answers
115
views
Cycle accuracy through the use of a microtable for an 8 bit CPU emulation?
I'm in the process of writing a 8 bit cpu emulator and currently have a jump table for different opcodes. I want to move this over to be cycle accurate and was wondering what the best approach would ...
63
votes
9
answers
14k
views
Novice programmer(s) frustrated by lack of a glossary of compiler errors
A friend of my family asked me for a bit of help as he learns to program (in the C language). As we were talking, he expressed frustration about having a hard time understanding the error messages his ...
-1
votes
2
answers
968
views
How to port gcnew and gcroot from Visual C++ to gcc [closed]
I have the task to port some code from Visual C++ to gcc.
Some calls are gcnew and gcroot to handle managed code inside cpp module.
How can these calls be ported to gcc in a fashionable way?
2
votes
1
answer
106
views
Does an explicit temporary of an integral type qualify as an integral constant expression?
In the following code, int() is an explicit type conversion.
#include <iostream>
int main()
{
void* ptr = int();
return 0;
}
Clang Compiler:
source_file.cpp:5:11: error: cannot ...
11
votes
2
answers
19k
views
Why C allows multiple global declarations of the same variable but NOT multiple local declarations?
I noticed that if I declare a global variable multiple times the compiler does not even output a warning.
However if I declare a local variable in a function multiple times, for example, the gcc ...