Questions tagged [compiler-warnings]

Messages emitted by a compiler which indicate potential problems in code or configuration.

Compiler warnings typically flag patterns in code that could potentially cause problems, but for lack of context the compiler cannot declare absolutely that the code is flawed.

2652 questions
1
vote
1 answer

How to fix a compiling warning on a C program 'char *'

I'm getting the below warning on a C program. It does run. However, how do I fix the warning? warning: format specifies type 'char *' but the argument has type 'char (*)[100]' [-Wformat] printf("%s\n", &buf); The code looks like…
Nick_Nick
  • 51
  • 6
1
vote
2 answers

kotlin when with subject should be used

I'm intrigued by kotlin's when statement. It seems almost as powerful as the lisp cond, but not quite. In one example on the kotlin web site here, you can see that there is no subject. You just list boolean expressions, and the first one to…
SMBiggs
  • 11,034
  • 6
  • 68
  • 83
1
vote
2 answers

C : Why passing arguments less then function defined, Only warning shows up (No any error and it can run normally )

this maybe is a special case. When i tracing a C code i saw warning . said implicit declaration of function 'Wifi_Hosts_Sync_Func' [-Wimplicit-function-declaration] i tried to eliminate it by using extern the function void *Wifi_Hosts_Sync_Func but…
郭維倫
  • 39
  • 6
1
vote
1 answer

"no user-provided default constructor" warning only with gcc

The following code issues a warning when compiling with gcc, but only with version <= 9.3 #include #include template struct A { using atype = std::array; template static…
francesco
  • 7,189
  • 7
  • 22
  • 49
1
vote
2 answers

C++ mark a function as experimental/not fully implemented

I have a function I will need to leave partially implemented for a variety of reasons and I want to prevent future users (read as me in the future when I have forgotten that I did this) to know the function is incomplete, buggy and untested. Option…
Makogan
  • 8,208
  • 7
  • 44
  • 112
1
vote
0 answers

Can I attach a warning handler to scalac from sbt?

I want CI to know wether the number of warnings in a project isn't increasing. I could parse the output of sbt, but that seems fragile. Can I pass a custom reporter to scalac that I can use to serialize out a warning list/summary so I can easily…
Martijn
  • 11,964
  • 12
  • 50
  • 96
1
vote
1 answer

How to eliminate "The expression of type List needs unchecked conversion to conform " warning?

The warning is Type safety: The expression of type List needs unchecked conversion to conform to Collection Do I need a type cast somewhere? public class ETLStepType { public static final ArrayList ETLStepTypes = ( …
nicomp
  • 4,344
  • 4
  • 27
  • 60
1
vote
1 answer

"setText: is deprecated" warning

When I run my app, a warning pops up that says "'setText:' is deprecated.how can i rewrite this line of code to get rid of the error? cell.text = [moreArray objectAtIndex:row]; Thanks
Sam
  • 799
  • 2
  • 8
  • 14
1
vote
1 answer

"Warning: Comma within array index expression" but comma is separating function arguments

MSVC reports warning C4709: comma operator within array index expression on the following line: intersections[img::at(rotJ, rotI)]; Without knowing more, is there any chance that this warning is valid?
Museful
  • 6,711
  • 5
  • 42
  • 68
1
vote
0 answers

Can we use python's type hinting to support type mismatch detection in binary operators?

What am I trying to do? Python's type hinting is useful for spotting certain coding mistakes, for instance if you accidentally try to call a type-hint decorated function with a mistake in the arguments. In statically typed languages we are also able…
Robino
  • 4,530
  • 3
  • 37
  • 40
1
vote
1 answer

What does #define Dbg(fmt,...) (0) mean? warning: expression has no effect

I am working on removing warnings from legacy code when I encountered the below macro #define DISBALE_DEBUG #ifdef DISBALE_DEBUG #define Dbg(fmt,...) (0) #else #define Dbg print #endif and used in the below code: #ifdef __arm__ Dbg("\n…
jxgn
  • 741
  • 2
  • 15
  • 36
1
vote
1 answer

Compiler warning about async shouldn't happen

So the following code triggers the compiler warning: "Async function without await operator will run synchronously" public async Task UpsertMariaDb() { IEnumerable insertTasks = InsertSomethingDb(); IEnumerable
1
vote
4 answers

Delphi Embarcadero XE: tons of warnings with String and PAnsiChar

I'm trying to migrate from Delphi 2007 to Embarcadero RAD Studio XE. I'm getting tons of warnings. They all look like this: I have a procedure where I declare a "String": procedure SendMail( ADestinataire,ASubject : String); And I'm trying to call…
Olivier Pons
  • 15,363
  • 26
  • 117
  • 213
1
vote
3 answers

Why is the result type of a sum of two unsigned integers different in Clang and GCC

I am writing some low level code for my emulator which involves a lot of 16 and 8 bit unsigned integers. I enabled -Wconversion warning in my project and all warnings are considered as errors (-Werror). Consider this code snippet: #include…
pankycodes
  • 61
  • 2
  • 6
1
vote
1 answer

Type parameter circumvents match exhaustivity warning

Why does type parameter bound by sealed type seem not to raise exhaustivity warning sealed trait A case class B() extends A case class C(i: Option[Int]) extends A def f[T <: A](a: T) = a match { case B() => case C(None) => …
1 2 3
99
100