NO

Author Topic: No warning about not referenced variables  (Read 264 times)

Offline Marco

  • Member
  • *
  • Posts: 14
No warning about not referenced variables
« on: January 22, 2021, 05:58:33 pm »
Hello!

While compiling the source code of one of my programs, I noticed that the compiler did not warn me about some declared (but not referenced) 'char' variables. It's a very minor issue, but I don't know if it's a compiler bug or not. Anyway, to reproduce the issue, just declare a couple of never referenced 'char' variables like the following:

Code: [Select]
int n = 8;
char str1[8];     <== warning #2114: Local 'str1' is not referenced.
char str2[n];     <== no warning

During the compilation, the compiler will not warn about the 'str2' variable.

Marco

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1926
Re: No warning about not referenced variables
« Reply #1 on: January 22, 2021, 07:27:46 pm »
char str1[8]; is static
char str2[n]; isn't static, even n is
May the source be with you

Offline Marco

  • Member
  • *
  • Posts: 14
Re: No warning about not referenced variables
« Reply #2 on: January 22, 2021, 11:23:05 pm »
char str1[8]; is static
char str2[n]; isn't static, even n is

Thanks Timo!