NO

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

Offline Marco

  • Member
  • *
  • Posts: 45
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: 2115
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: 45
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!