Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

I'm trying to set up VS Code to learn C++. I downloaded the latest version of the compiler (g++) and tried running the following simple code, which (if I understand this correctly) should print a &...
Pickman02's user avatar
  • 101
-2 votes
1 answer
309 views

Compiling Lua (version 5.4.7) with the GCC 15.2.0 compiler as C++, I get a strange warning message ...\lauxlib.c|586|warning: 'memcpy' specified bound 18446744073709551614 exceeds maximum object size ...
AVK's user avatar
  • 2,178
1 vote
1 answer
77 views

I have an array of pointers to structs in C as typedef struct{ int elem1; char *elem2; ... }example_t; example_t *array[MAX_SIZE]; I did generic functions for add or delete pointers to ...
Daniel Muñoz's user avatar
0 votes
1 answer
73 views

I'm trying to compile an example program from chapter three of Volume One of the Xlib Programing manual. I get an error saying that there is no such file or directory for #include "bitmaps/...
voidkitten's user avatar
1 vote
1 answer
97 views

This question can be considered probably theoretical as I don't see why I would have such design in real code. I've got two classes with some conversion operators: class B; class A { public: A()...
Oersted's user avatar
  • 3,732
5 votes
2 answers
188 views

I've been compiling my C code against some very "non-default" warnings and found a potential GCC bug - a false positive caused by -Wc++-compat. Before explaining anything, it would probably ...
sleeptightAnsiC's user avatar
4 votes
1 answer
285 views

In our codebase we have code that boils down to the following (trying to use dynamic stack allocation instead of heap allocation): #include <memory> #include <alloca.h> void f(long long ...
akryukov's user avatar
  • 187
3 votes
2 answers
118 views

As we all know and love (or hate), GCC has the capability of issuing warnings when you attempt to use the printf() family of functions with mismatched type specifications. In our code, we have a ...
Ken P's user avatar
  • 580
0 votes
0 answers
587 views

The following c++ code gives me a Wdangling-reference warning with gcc 13/14 when I compile with -Wall -Wextra. # include <iostream> std::string create_default_x() noexcept { std::string ...
Caduchon's user avatar
  • 5,278
-1 votes
1 answer
157 views

i have a copy_object function which basicly just makes a copy of any object given a pointer to it and its size and i use it in a library i made here is the function /// @brief dynamically allocates a ...
abdelrahman Mohamed's user avatar
9 votes
2 answers
2k views

In the following C++ code GCC 14 with -Wall -Wextra flags produces a possibly dangling reference warning for function g(), but not f(). Why? /* getval.h */ #include <string> std::string const &...
akryukov's user avatar
  • 187
0 votes
1 answer
287 views

I am trying to write a simple Hello World Program using assembly and NASM. This is the code: section .data hello db 'Hello, World!', 0 ; The string to print section .text global _start ...
Θάνος Δριβάκος's user avatar
2 votes
2 answers
707 views

I saw many other questions about the very same warning, but my code seems different. And, over all, I get this only with -Os option. #include <iostream> using namespace std ; template <class ...
Captain'Flam's user avatar
1 vote
3 answers
161 views

I need to define a type formed with 2 24-bit fields (48 bits in total). I didn't find a way to do it with bitfields in a struct. So I defined my type with a union and 2 anonymous structs : typedef ...
clem822's user avatar
  • 11
3 votes
1 answer
174 views

If I compile the following code with -std=c17 -Wall -Wextra -Wpedantic with GCC 13.2.0, I get no warnings, despite not using void* in arguments corresponding to "%p" format specifiers. #...
Wolf's user avatar
  • 10.3k
1 vote
0 answers
87 views

This (simplest-example) program is set up so main() calls the makeKey() function and fails to check the return value ...Which demonstrates why, when programming, especially security critical code [I'm ...
BlueChip's user avatar
  • 170
-5 votes
3 answers
264 views

Below is the code I'm compiling: #include <stdio.h> void main() { printf("Hello%cWorld\n", 0); } Below is the compiler output: HelloWorld Bing Chat-GPT response:start Below is ...
Anton's user avatar
  • 125
0 votes
1 answer
277 views

I am getting warning for below program #include <stdio.h> int main(void) { int num = 0xff; printf("%B\n", num); printf("%b\n", ~num); printf("%b\n",...
mrigendra's user avatar
  • 1,598
3 votes
1 answer
531 views

Compiling my code with gcc 13.2 and -Wdangling-reference I was surprised that in this simple scenario (godbolt): #include <vector> #include <string> std::string& add_variable(std::...
MatG's user avatar
  • 796
1 vote
2 answers
212 views

I have the following code: typedef struct S1 S1_t; struct S1 { uint8_t *ptr1; uint8_t **ptr2; }; void get_ptr1(const S1_t *s1, uint8_t const **ptr1) { *ptr1= s1->ptr1; } void get_ptr2(const ...
kokopelli's user avatar
  • 372
0 votes
0 answers
118 views

I've got the problem for the C language still I can't run my code and see the output after installing gcc and the code runner extension still, I can't run my simple code in Visual Studio code my code ...
Mark Najafi's user avatar
1 vote
3 answers
2k views

This warning seems to not be necessary. In my code, I have a function pointer type (void*)(*function_pointer)(void* data) and some functions require function pointers of this type as a parameter, ...
Vulgo's user avatar
  • 35
0 votes
2 answers
133 views

extern void myprint(unsigned char *); static inline void myfunc(unsigned char *buf) { for (unsigned int i = 0; i < 20; i++) { buf[i] = i; } } int main(void) { unsigned char ...
pozzugno's user avatar
  • 846
1 vote
2 answers
213 views

This warning is issued by the G++ compiler starting from GCC-13. Clang++ 17 is happy with this code. MSCV 19 produces the similar warning (39): warning C4263: 'Derived &Derived::operator =(const ...
emerg.reanimator's user avatar
1 vote
1 answer
213 views

I'm following this repository text to be able to use openCV on a ESP32-CAM. I am able to make it work with the default libraries (imgcodecs, imgproc & core), but when trying to add calib3d, I get ...
Daniel Bajo Collados's user avatar

1
2 3 4 5
18