Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
54 views

I disassembled a 7,838,304-Byte portion of /usr/lib/x86_64-linux-gnu/dri/i965_dri.so using Capstone as shown below: #include <stdio.h> #include <string.h> #include <stdint.h> #...
TheAhmad's user avatar
  • 940
1 vote
0 answers
54 views

I need to install RStan and I want to make sure that it's as efficient as possible. I'm using gcc. I'm reading this guide from 2022. Luckily, the Stan developers built an option called STAN_CPP_OPTIMS ...
AnthonyC's user avatar
  • 705
11 votes
1 answer
619 views

Consider the following simplified code: template <class T> class Foo { T t; const T* t_ptr; public: constexpr Foo(T t): t(t), t_ptr(&this->t) {} constexpr Foo(const Foo&...
eyelash's user avatar
  • 4,126
1 vote
0 answers
88 views

I am making my own UNIX like OS called Connor's UNIX and I am implementing kernel and userspace separation and I have been all day and this is as far as I can get it to work and if you need any more ...
Connor Thomson's user avatar
-1 votes
0 answers
67 views

I'm following the barebones guide on OSDev Wiki and I'm trying to compile my kernel.c file with i686-elf-gcc -ffreestanding -O2 -m32 -c kernel.c -o kernel.o but I constantly get the following ...
James Cho's user avatar
3 votes
2 answers
105 views

I have an application where I need to generate date and time based on the locale using the strftime function provided by C's time.h: #include <stdio.h> #include <time.h> #include <...
Micro Soft's user avatar
2 votes
0 answers
44 views

Regardless of --build or --target, when configure points out the I'm trying to compile GNU pth in 32-bits form under Linux. Toolchain used: Ubuntu 24.04.2 (VM) gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13....
Marc St-Jacques's user avatar
Advice
0 votes
4 replies
184 views

Title: Why does GCC transform a >= 4 into a > 3 at -O0? JG seems more complex than JGE I'm analyzing a simple C code on godbolt and found GCC's code generation puzzling: long a; a = a >= 4; ...
Alexandr's user avatar
Tooling
0 votes
0 replies
42 views

A friend of mine has an application in C he has been helping to maintain, which he has been building for Linux, but he asked me to help build Windows binaries. The project has a Makefile.win32, so it ...
CalicoSkies's user avatar
Advice
0 votes
1 replies
42 views

Disclaimer: I'm expecting that the answer to this question will be that it can't be done, but I'm asking as a just in case. I am working on a JIT'd language with the compiler and runtime implemented ...
idka's user avatar
  • 131
Tooling
0 votes
3 replies
98 views

Which IDE and tools are best suited for gcc C development? I currently use vscode and the tried using the ms-vscode.cpptools extension which "supports" gcc C. But extensions like nested ...
mcmah309's user avatar
Advice
2 votes
6 replies
121 views

Does anyone know if there is, in c++, any way to determine at runtime the cpu characteristics of the machine that compiled the code? For example, in gcc (which I'm using) the preprocessor variable ...
user3195869's user avatar
Advice
0 votes
6 replies
80 views

I have a AVR GCC toolchain compiled to work on aarch64-linux-gnu devices (ARM64) and it produced twice larger file (around 35Kb) than almost identical command-line on desktop (mac silicon, around 20Kb)...
4ntoine's user avatar
  • 20.6k
3 votes
1 answer
119 views

I stumbled upon different behavior of std::filesystem::path::parent_path() when a path contains leading slashes. Clang says that the parent of ///a is /// (which is what I would expect), but GCC says ...
danpla's user avatar
  • 705
1 vote
2 answers
149 views

Take the below piece of code, that simply Trims a string, removing whitespace characters from either end: const std::string TrimString(const std::string& s) { const auto iter = std::find_if(s....
The Welder's user avatar
  • 1,099
3 votes
2 answers
190 views

I have two functions counting the occurrences of a target char in the given input buffer. The functions vary only in how they communicate the result back to the caller; one returns the result and the ...
Devashish's user avatar
  • 193
0 votes
0 answers
40 views

For -std=c17 (and higher) DW_AT_language is C11: $ echo "int x;" | gcc -c -xc - -fPIC -o x.o -g -std=c17 $ gcc -shared -o x.so x.o $ readelf x.so -w | grep -P '(DW_AT_language\s*:|DWARF ...
pmor's user avatar
  • 6,757
0 votes
1 answer
105 views

I'm trying to build, using CMake, a program involving C++ and CUDA-C++ code. It used to build file, several months ago, but - now am getting a linker error I'm not familiar with: in function `main....
einpoklum's user avatar
  • 137k
1 vote
0 answers
90 views

The following code compiles in gcc15 with g++ -std=c++17 #include <iostream> int main() { int A, B; std::cin >> A >> B; auto v = std::tie(A, B); } However, this is ...
EJam's user avatar
  • 389
0 votes
2 answers
84 views

I'm on Windows OS and in the past month I used to compile a C/C++ project in Qt Creator IDE using MinGW's gcc/g++ compilers based on POSIX thread model, i.e. compilers that were built with the option -...
ahahfilip's user avatar
Advice
0 votes
8 replies
144 views

I recently learned about C23's implementation for #embed, so I was wondering if I can use that with extern in a c++23 program/game to have all 3d models and assets baked into the exe but not in memory ...
jade22's user avatar
  • 13
0 votes
1 answer
20 views

I have a program targeting a small memory ARM R5 CPU, being compiled with gcc 11.2.0 and ld 2.37.20210721. I have a critical symbol that I would like to know the address of, even if the binary was ...
Seth Robertson's user avatar
6 votes
0 answers
143 views

I was experimenting with some fixed-point arithmetic on the Cortex-M0+ in Godbolt's compiler explorer and came across an interesting behaviour with respect to the optimisation of a multiplication ...
Simon's user avatar
  • 664
0 votes
1 answer
52 views

I try to build some source code containig Win32 API code with GCC 8.3.0 (i686-posix-dwarf) that comes with Strawberry Perl Portable package. It easily builds code, but struggles when it comes to ...
DLWHI's user avatar
  • 145
Best practices
2 votes
10 replies
288 views

In C, when I pass a pointer to a function, the compiler always seems to assume that the data pointed to by that pointer might be continuously modified in another thread, even though in actual API ...
Moi5t's user avatar
  • 465
4 votes
1 answer
95 views

Looking at this benchmark about a custom std::function implementation: https://github.com/PacktPublishing/Hands-On-Design-Patterns-with-CPP-Second-Edition/blob/main/Chapter06/09_function.C I tried to ...
luczzz's user avatar
  • 446
Advice
2 votes
10 replies
395 views

I'm a small-scale C programmer at the moment, and I'm bugged by the question: is Visual Studio worth the annoyance that it is? I've been programming in C and C++ in Visual Studio Code for a while, and ...
Gaspar Liboreiro's user avatar
4 votes
0 answers
412 views

I've been investigating the assembly output for a simple C++ loop involving a const array and const size, and I've encountered peculiar version-specific behavior with GCC on Compiler Explorer. My ...
BullRMachineR's user avatar
2 votes
3 answers
100 views

I have created a simple hello.c which contains just the definition of an array: unsigned char arr[4] = {1,2,3,77}; I have then compiled it with gcc -r in order to produce a relocatable object file. ...
Sterpu Mihai's user avatar
3 votes
2 answers
150 views

Please consider the following minimal example: #include <stdio.h> // Compile with: // gcc -g -o myprogram main.c //#define SPECIAL typedef struct { int id; char name[50]; float value; } ...
sdbbs's user avatar
  • 5,948
3 votes
0 answers
180 views

While investigating some spurious tests in a x86-64Bit Yocto-based Linux system, that there were multi Byte writes to a register of a PCIe card, instead of an expected single double word write. A ...
arminveres's user avatar
2 votes
1 answer
226 views

Today I switched to Win11 and can no longer compile a program i was working on with gcc in wsl without "implicit declaration of function ‘mempcpy’" warnings. Before switching to Win 11 (from ...
Ben's user avatar
  • 23
5 votes
1 answer
239 views

I expected this to print 11112222deadbeef (it does at -O0), but at -O3 it prints 1111222233334444. https://godbolt.org/z/MfeEM8fqP #include <stdint.h> #include <stdio.h> __attribute__((...
vengy's user avatar
  • 2,467
2 votes
1 answer
166 views

I'm developing a video game in C++ and Vulkan with modding support, I would really like the modding to be done through C++ (the game is optimized quite well, so I would really like the modding to be ...
Ziggy Harding's user avatar
0 votes
1 answer
114 views

According to OL-PRODUCT-LIFECYCLE.pdf , Table 2-6, GCC-Toolset 15 is available in application stream of Oracle Linux 8.10 . However, dnf install gcc-toolset-15 fails. It can be reproduced in a docker ...
user31649152's user avatar
2 votes
2 answers
215 views

I am launching my a.out application manually by passing it as an argument to dynamic loader like below. My application is compiled in debug mode. *gdb --args /lib64/ld-linux-x86-64.so.2 ./a.out I am ...
vinit Tirnagarwar's user avatar
1 vote
0 answers
47 views

on .elf formats, there is a .comment section that includes compiler & linker names and versions, this is fine since its discardable via editing the linker scripts However on Windows .exe's, while ...
PxHGhost's user avatar
0 votes
1 answer
92 views

I was trying to compile my python program to the smallest executable and I was pleased with this nuitka --python-flag=-OO --onefile updater.py As it produced this on my machine -rwxrwxrwx 1 filip ...
Filip's user avatar
  • 182
2 votes
2 answers
120 views

After some package upgrade on my Ubuntu 24.04 I stumbled upon inability to build/install/work with almost any of golang packages. So, I'm trying to install staticcheck and get the following error: $ ...
milo's user avatar
  • 1,260
0 votes
0 answers
34 views

I'm cross-compiling avr-gcc statically (in order not to depend on Android linker) to work on aarch64 android devices. gcc is compiled with the flags: generic_arm64:/data/data/myapp/files/sdk/hardware/...
4ntoine's user avatar
  • 20.6k
1 vote
1 answer
64 views

There are two ways to create VxWorks applications: Real-time processes (RTP), which are akin to a process in the Unix world. Downloadable kernel modules (DKM), which run in kernel mode, akin to a ...
dividebyzero's user avatar
  • 2,288
4 votes
1 answer
94 views

I am getting a warning (turned into an error with -Werror) about missing-field-initializers when using designated initializers for the fields in my struct, because I'm not initializing fields in a 3rd ...
Steve Lorimer's user avatar
0 votes
0 answers
72 views

I have cross-compiled GCC to run on Android arm64 device and i can run it on emulator with "adb shell": 130|generic_arm64:/data/data/com.mycompany.myproject/files/sdk/hardware/tools/avr/bin #...
4ntoine's user avatar
  • 20.6k
3 votes
0 answers
111 views

TLDR: On an embedded system, I have to place certain buffers to their own section to be used with DMA. However, the resulting section seems to contain unexplainable gaps. What could be going wrong? ...
Timo's user avatar
  • 971
2 votes
3 answers
187 views

The following derives from this question but is distinct Consider the following code sample; uint32_t *value = malloc(sizeof(uint32_t)); *value = 0xAAAABBBB; int16_t *subset = (int16_t*) (value); ...
Nil A Curious Programmer's user avatar
3 votes
1 answer
133 views

I have included the reflect-cpp header into a source file. It compiles. However if I add: -fsanitize=undefined It no longer compiles and complains that: /app/raw.githubusercontent.com/boost-ext/...
Zebrafish's user avatar
  • 16.3k
1 vote
1 answer
72 views

I'm trying to assemble some basic testing code for an embedded device I'm reverse-engineering, which runs little-endian xtensa threadx. From googling the only assembler that seems to support xtensa in ...
perniciousquery's user avatar
-3 votes
1 answer
131 views

I tried to make the SDL header into a precompiled header, and I noticed that when I do -save-temps or -E to ouput the precprocessed translation unit, there is no difference between just including the ...
Zebrafish's user avatar
  • 16.3k
0 votes
0 answers
43 views

Nodes: building a gcc_tree_node for a custom prograimming language compile and base on C++26 the modules are avilable the language using tab-block system every keyword start with '/' I want to ...
Adam Bekoudj's user avatar
0 votes
2 answers
145 views

This problem arose while I was writing a program to retrieve file sizes. I wanted to learn more about file management and other file related things, so I wrote a c++ program using the fstream and ...
Liam Verdon's user avatar

1
2 3 4 5
846