Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
86 views

With avr-gcc 14, the compiler gives this warning: avrenv.c: In function ‘main’ avrenv.c:12:13: warning: ‘strncpy’ output may be truncated copying 255 bytes from a string of length 509 [-Wstringop-...
Torsten Römer's user avatar
9 votes
2 answers
188 views

In the code below, I get the follow compilation warning: error: variable 'process_arg' set but not used [-Werror=unused-but-set-variable] const auto process_arg = [&]<typename T>(const ...
Hazen's user avatar
  • 389
4 votes
2 answers
171 views

Had a bug in this code: bool x; for(const auto a : b) { x = x && a.b; } x should have initialized to true. I'd like to raise a compiler error that the bool wasn't explicitly ...
intrigued_66's user avatar
  • 17.6k
2 votes
4 answers
441 views

#include <stdio.h> #include <stdlib.h> typedef struct { int a; } tempStruct1; typedef struct { int b; } tempStruct2; typedef struct { tempStruct1 *temp1; tempStruct2 *...
IQUnderflow's user avatar
3 votes
1 answer
171 views

Let's say I want to wrap the classical LogInformation() method with a custom one: public static void Info(this ILogger log, string message, params object[] objects) { // ... some custom logic ...
Massimiliano Kraus's user avatar
0 votes
0 answers
65 views

#include <stdio.h> //extern int printf(const char* __restrict, ...) __attribute__ ((format (printf, 1, 2))); void test_func(void); void test_func(void) { int test_object = 0; printf(&...
charmoniumQ's user avatar
  • 5,583
4 votes
2 answers
188 views

I have the following warning generated by a printf(): warning: format '%llu' expects argument of type 'long long unsigned int', but argument 7 has type 'uint64_t' {aka 'long unsigned int'} [-Wformat=]...
virolino's user avatar
  • 2,331
6 votes
0 answers
233 views

I have the following C code: #include <stdio.h> void MyFun(int a, int b) { printf("a = %d, b = %d\n", a, b); } int main(void) { int x = 1; MyFun(++x, x++); return 0; }...
vengy's user avatar
  • 2,467
0 votes
0 answers
105 views

I want to write a declaration, templated on a type, such that: If not instantiated, triggers no compiler warnings or errors, even with strict warning flags. If instantiated (e.g. by being used), ...
einpoklum's user avatar
  • 138k
3 votes
2 answers
94 views

I recently read the NASA's power of 10 rules, and thought the rule about "using the compiler's most pedantic setting" was very interesting, considering warnings exist for a reason. I already ...
Alex RD's user avatar
  • 33
10 votes
1 answer
755 views

Consider the following program: int main() { int* ptr = nullptr; return *ptr + 1; } (also on GodBolt) How is it, that with "decent" warnings enabled (-Wall -Wextra), both popular ...
einpoklum's user avatar
  • 138k
1 vote
1 answer
208 views

Normally, I can place function calls after std::unreachable, and it has no effect. This works on MSVC, Clang, and GCC, except with GCC there is an extra detail that makes it fail compilation: #include ...
Zebrafish's user avatar
  • 16.5k
2 votes
1 answer
167 views

My program contains a template function like this: template<typename Key> Key getChoiceWidgetSelection(wxChoice& choiceWidget, bool *ok) { Key ret; *ok = false; ...
rexkogitans's user avatar
0 votes
1 answer
124 views

I'm new to Scala and the @nowarn system seems a little bit confusing. I've tryed to remove lint errors on Function1 and Function2 with nowarn, but it didn't work. So, here's this programm: import ...
Nikita Shadkov's user avatar
7 votes
1 answer
226 views

This code snippet triggers a warning in MSVC (VS2022 17.10.2). int m = 0; if(int i = m) // ... else if (int i = m) // warning C4456: declaration of 'i' hides previous local declaration // ... ...
Lars's user avatar
  • 81
15 votes
1 answer
244 views

I have a code base which makes extensive use of char8_t and char32_t to represent UTF-8 code units and Unicode code points respectively. A common mistake/bug in this code base is to compare char8_t to ...
Jan Schultke's user avatar
  • 44.4k
-1 votes
1 answer
167 views

I am working on a React page that has a built in file manager. I have a DocumentTable.js component, which is responsible for displaying the current list of files available, and it has (among others) ...
user30266210's user avatar
27 votes
5 answers
2k views

Compiler warnings generally provide useful hints for common programming errors. It is often recommended to turn compiler warnings into errors (e.g. here). In my experience, this is useful to prevent ...
Christian Stadelmann's user avatar
2 votes
1 answer
220 views

I got many compiler warnings for the eigen library, one example being: Warning C4819 The file contains a character that cannot be represented in the current code page (950). Save the file in Unicode ...
SakuraEma's user avatar
2 votes
0 answers
367 views

I'm trying to remove all clang-tidy warnings in my C++ project. But I get alternating modernize-deprecated-headers and misc-include-cleaner warnings. For example: I use open_memstream in a file, so I ...
DeZe's user avatar
  • 23
1 vote
1 answer
63 views

I want to provide a function to convert parameters, which are read as long long or long double from XML, to any type constructible from these types with narrowing conversion. But I want to use list ...
H.v.M.'s user avatar
  • 1,746
0 votes
0 answers
428 views

I have a solution with 5 projects: Project 1-3 are SDK-style projects with PackageReference. Project 4 is a legacy .csproj project with packages.config (.NET Framework 4.7.2. WebForms + MVC 5 project ...
Kjell Rilbe's user avatar
  • 1,623
12 votes
1 answer
406 views

With a structure such as the following typedef struct { size_t StringLength; char String[1]; } mySTRING; and use of this structure along these lines mySTRING * CreateString(char * Input) { ...
Morag Hughson's user avatar
1 vote
1 answer
585 views

When working with .NET Standard 2.1 code, I found a strange behaviour when there should have been a warning to a nullable parameter but it does not: And I can reproduce it with a simple method: #...
Luke Vo's user avatar
  • 21.6k
0 votes
1 answer
66 views

Consider this class: public class Number { [System.Obsolete()] public string ToExactString() => ""; [System.Obsolete()] public override string ToString() => "&...
Mike Nakis's user avatar
  • 63.1k
6 votes
1 answer
342 views

Java 21 introduces a new this-escape warning which warns against situations where a constructor is calling a method which can be overriden by a subclass. This is a potentially dangerous situation ...
whaleberg's user avatar
  • 2,201
-2 votes
1 answer
154 views

I don't understand the philosophy behind the Java compiler not warning on downcasting when it think it may potentially succeed. In particular, the following compiles without any warning (and I am ...
user29120650's user avatar
1 vote
1 answer
59 views

Conside this simple class in C# (nullability feature enabled): public class Error { public string Message = "..."; public static implicit operator bool(Error? err) => err is not ...
chainerlt's user avatar
  • 267
2 votes
2 answers
232 views

From what I understand the recommended method to hide null warnings on services is the following: [Inject] private IExampleService ExampleService { get; set; } = default!; https://learn.microsoft.com/...
Dillan K's user avatar
3 votes
3 answers
159 views

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* ...
x-yuri's user avatar
  • 19.5k
1 vote
2 answers
117 views

I'm trying to set up an array of functions that takes in functions that need different variables (for example, my_putchar needs a char while my_put_nbr needs an int), so I just decided to define it ...
The Hollow Owl's user avatar
7 votes
0 answers
2k views

I have a simple .NET 8 (C#) class library that reads some registry values. It was created and built in Visual Sudio 2022 (64 Bit) v17.11.5. PROJECT FILE: <PropertyGroup> <TargetFramework&...
Raheel Khan's user avatar
  • 14.8k
0 votes
0 answers
85 views

What warning on GCC and/or clang do I need to activate for this to give a warning? #include<numeric> ... std::vector<double> vec = {1.0, 2.0, 3.0}; auto const sum = std::accumulate(vec....
alfC's user avatar
  • 16.8k
3 votes
0 answers
108 views

Consider the following program: #include <stdint.h> #include <stdio.h> int64_t foo(void) { return -1; } int main(void) { size_t x = foo(); printf("x = %zu\n", x); ...
grendell's user avatar
0 votes
1 answer
275 views

I have a project written in Visual Studio 2022 c++ with Qt5.15.2 (x64). It comiles and works just fine. During compilation I get a warning for each widget-derived-class in my project. Moc'ing ...
Der Achim's user avatar
0 votes
1 answer
150 views

The following Fortran code should give a value close to 2/3. ! File "buggy.f90". program buggy implicit none integer, parameter :: n = 1000 integer :: i, k logical :: c1, c2 real,...
Michel Fioc's user avatar
4 votes
2 answers
688 views

I want to enable IDE0058 as an error during build. Here's how I attempted to do that. Start Visual Studio 2022 (Version 17.11.2) Create new project. Project type: C#, Windows, Console -> Console ...
Thomas Weller's user avatar
5 votes
2 answers
159 views

Given following C code: #include <stdbool.h> int main (void) { true; return 0; } I expect that -Wunused-value would cause a warning at line 5: true; because this statement does ...
sleeptightAnsiC's user avatar
-2 votes
2 answers
162 views

I have noticed an inconsistent behavior in my production C++17 code regarding generic lambdas and notes. I was finally able to break it down to the following minimal example. Gives a note with x86_64 ...
SoulfreezerXP's user avatar
0 votes
1 answer
492 views

It looks like meson is picking compiler flags from pkg-config and consequently setting include paths to dependencies using the -I flag. This leads to annoying warnings if you start turning on enough ...
skyking's user avatar
  • 14.6k
-2 votes
1 answer
145 views

Recently I've met a bug in C++ project related to an unnamed scope guard, like in this question: LockGuard(mutex); See simple demo. This kind of bug is really hard to find by reviwing changes, and ...
Rom098's user avatar
  • 2,651
1 vote
2 answers
87 views

I recently tried to build a project with clang and clang++. Up to now it has only been built with GCC. One of the problems that I saw was with code that is of the following form if (expression) { ...
Paul Floyd's user avatar
  • 7,328
1 vote
1 answer
118 views

I am doing something like this in the Blazor HTML section... <EditForm EditContext="editContext" OnValidSubmit="SubmitQuery"> <DataAnnotationsValidator /> <...
Jbtatro's user avatar
  • 123
2 votes
2 answers
405 views

I was hoping someone can explain why the compile function is not working as I would expect. First question: * (compile 'square (lambda (x) (* x x))) SQUARE NIL NIL But then: * (square 3) ; in: SQUARE ...
davypough's user avatar
  • 1,951
3 votes
0 answers
83 views

When specifying the command line options -Wstrict-overflow=4 and -O3, extracting a timepoint (e.g. std::chrono::local_seconds) from a stream object triggers some warnings from GCC (v14.1). Inserting a ...
digito_evo's user avatar
  • 3,735
0 votes
1 answer
149 views

The following method works fine when T and the types of all its components are specific types (contrary to abstract type parameters). import scala.compiletime.* private inline def loop[T <: Tuple, ...
Readren's user avatar
  • 1,290
0 votes
1 answer
437 views

I tried to replicate the assembly workspace that i have to study on my windows pc (where i have instruction to how installe and use wsl) on my linux pc but when i try to assemble by using ./assemble....
Francesco Bonistalli's user avatar
0 votes
0 answers
123 views

I just had the worst problem ever in my mixed C/C++ project. The C code is the production code, the C++ is the testing environment. We are compiling with MinGW GCC, but developing on Qt Creator which ...
Charles's user avatar
  • 1,329
1 vote
1 answer
567 views

I got this warning: Warning: Interpolation-only expressions are deprecated on best.tf line 69, in locals: 69: pools = length(var.instances) > 0 ? { "${var.name}" = var....
Positive Navid's user avatar
0 votes
0 answers
67 views

I am following this documentation I want to treat all warnings as error and ignore these specific warnings but I get an error: set _CL_="-WX -WD28020 -WD28112 -WD28132 -WD28159 -WD28182 -WD28195 -...
Node.JS's user avatar
  • 1,724

1
2 3 4 5
56