42,293 questions
Score of 2
1 answer
87 views
MSYS2 GCC doesn't compile when it's not at the top of PATH
I'm using MSYS2 with UCRT64.
When "C:\msys64\ucrt64\bin" is below "C:\Program Files\Meld" in system PATH, gcc doesn't compile, but shows no error.
Meld folder has a few .dll files ...
Advice
0
votes
5
replies
73
views
How can gcc retrieve FOLDER ownership etc., in fact ALL the information that stat() gives about a file?
I have been searching man pages, web pages and all sorts of links trying to find an answer to this question but have returned nothing but descriptions of stat and stat() without any indications that ...
Score of 1
1 answer
219 views
Template fails to auto convert argument `const char *` to `const std::string & [duplicate]
In (template) function calls an actual argument of const char * is (usualy) automatic converted to const std::string &.
But not in all cases and I do not know how to fix the failing cases.
I am ...
Best practices
2
votes
2
replies
146
views
Faster unsigned divide 7 (and 19 etc) on Aarch64 - GCC & Clang
Having experimented with Compiler Explorer, it seems that both GCC and Clang implement unsigned divison by 7 using multiplication by k=(2^35+3)/7 and shifting right 35 bits (as e.g. explained in ...
Advice
1
vote
9
replies
295
views
Gcc vs Clang for low level systems programming: which is better and why?
Between GCC and Clang, which compiler is generally better for low-level programming (C/C++) and systems development, and why?
I’m not asking about performance benchmarks only, but about things like ...
Advice
2
votes
1
replies
91
views
Why did GCC drop the progbits flag in .section directives for objects in .data, .rodata?
Consider the following C/C++ compilation unit
extern int i;
int i = 1;
extern const int c;
const int c = 1;
And compiled with:
$ gcc -xc++ x.c -S -fdata-sections -static -o - | grep '\(data\|GCC\)'
...
Score of 1
2 answers
107 views
Multiple definition error in simple Qt6 project compiled with gcc 16.1
I configured, compiled, and installed GCC 16.1 on my WSL2 Ubuntu22, configured trivially configure --disable-multilib, installed under default location /usr/local.
Then I noticed that all my Qt ...
Advice
1
vote
7
replies
166
views
Is it possible to change case in macro definitions?
The question is for gcc specifically.
Assuming we are doing "enumeration with explanation":
#include <stdio.h>
#define COLORS(X) \
X(red) \
X(green) \
X(...
Best practices
0
votes
2
replies
105
views
Implications of VLA Compound literal GCC extension
Browsing through the GCC docs, I noticed the following:
As a GNU extension, GCC allows compound literals with a variable size. In this case, only empty initialization is allowed.
And indeed, the ...
Best practices
1
vote
5
replies
129
views
ARM GCC 16.1.0 - sub-optimal compiler behaviour for division by 7 etc?
I am using Compiler Explorer and ARM GCC 16.1.0 with -OFast option, 32-bit (though I think the same issue applies with 64-bit). The following C code:
int divide( unsigned int num) {
return num/7;...
Score of 0
0 answers
91 views
Unable to disable -pie with -no-pie. Both -pie and -no-pie are on compile line
I run a command like the following on my x86_64 host to build ARM binairies.
make V=1 -C ./$TFA -j4 CROSS_COMPILE=$CC64 \
CFLAGS=-fno-pie LDFLAGS=-no-pie ARCH=aarch64 \
PLAT=k3 SPD=opteed ...
Score of -3
2 answers
210 views
I don't understand what they are referring to by deprecated is the global declaration of x is what is deprecated? [duplicate]
english is not my native language i tried using translators but nothing works i am trying to understand this from cppreference
(deprecated) Namespace scope declaration of a static data member that was ...
Score of 2
2 answers
161 views
R package ggvoroni (deprecated) needs rgeos (deprecated)
I'm using R version 4.6.0 and want to install the deprecated package ggvoroni which needs the deprecated package rgeos.
When I run
remotes::install_version("rgeos", version = "0.6-4&...
Score of 0
0 answers
76 views
Why does alignment increase cause weird behavior?
I have an avx2 implementation of cryptographic hash LSH512-512 with context implementation:
typedef struct st_lsh512_avx2_context {
size_t bidx;
size_t length;
alignas(32) simde__m256i ...
Score of 6
2 answers
293 views
Not able to compile code shown on the "The Linux Foundation" YouTube channel
I was watching this video What Is an ABI, and Why Should You Care? by Shung-Hsi Yu, SUSE and in the first few minutes they showed the following code and compiled it as follows:
geo.h:
struct point {
...