862 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
41
views
VS Code not printing warnings
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 &...
2
votes
2
answers
84
views
With gcc `-Wunused-parameter`, how can I make it ignore empty functions?
GCC's -Wunused-parameter warns about unused function parameters. Is there a way to disable this warning for empty functions?
-2
votes
1
answer
394
views
GCC warning: 'memcpy' specified bound 18446744073709551614 exceeds maximum object size 9223372036854775807
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
0
votes
0
answers
121
views
GCC warning "is partly outside array bounds of ‘MyClass [1]’ [-Warray-bounds=]"
I tried to implement a method caller for vectors to forward it to a class method taking scalars. E.g. if I have a class with a method taking a double and an integer I want to be able to call it with a ...
1
vote
1
answer
79
views
Level of type casting of pointers?
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 ...
1
vote
0
answers
225
views
How to conveniently suppress false positives for GCC's null-dereference warning?
As of version 15.1 GCC frequently reports -Wnull-dereference warning for functions known to return NULL.
This is a useful warning and has exposed some potential null-pointer de-references in the code-...
0
votes
1
answer
82
views
Trying to compile an example X11 program using gcc, failing to find "bitmaps/icon_bitmap"
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/...
2
votes
1
answer
81
views
"Variably modified" warning with #defined sizes
The following C snippet, when compiled with ARM GCC 13.2.1 (Godbolt link):
#include <stdint.h>
#define LEDLINE_LED_COUNT 5
// LED delay buffer parameters; adjust the first two if you ...
1
vote
1
answer
102
views
Ambiguous conversion warning: should I care?
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()...
3
votes
1
answer
102
views
Calling C function from the .init3 section of a AVR-GCC compiled program
I am working on a project that contains a firmware update failure feature that :
notifies user/host that firmware update failed whenever the device gets unplugged in the middle of a firmware update ...
5
votes
2
answers
195
views
Is warning yielded by -Wc++-compat about identifiers not yet expanded by macro a false positive?
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 ...
3
votes
3
answers
159
views
How do I resolve the "control reaches end of non-void function" warning in the case with a custom error handler?
Consider the following example:
a.c:
#include <stdlib.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
char *invocation_name;
static void handle_error(const char* ...
4
votes
1
answer
327
views
GCC bogus "may be used uninitialized " warning starting with version 11
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 ...
2
votes
2
answers
370
views
What do gcc -Wabi-tag warn me for and how should I avoid that
When enabling -Wabi-tag I get the warning when trying to return std::string (by value). What is the purpose of this warning, ie what harm could ignore it lead to?
What options are there for avoiding ...
3
votes
2
answers
121
views
How to leverage the [*]printf format type specification warnings?
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 ...