title: C: Why overflow in implicit constant conversion [-Woverflow]?
body: <p>Using crappy Eclipse Nios II which uses GCC 4. Included a file, which can be found as font8x8_basic.h online . I had warnings that I was indluding the file multiple times, so I was experimenting with adding key words <strong>const</strong> and <strong>extern</strong>, having only the inclusion in main to make it global.
  <strong>extern</strong> should not be used if an initialization is done, correct?</p>
  
  <p>However, taking away <strong>const</strong>, gives me the warning of implicit constant conversion. Taking away <strong>const</strong> from the definition, doing clean, the error still remains!!? </p>
  
  <p>In font8x8_basic.h</p>
  
  <pre><code>#ifndef FONT8x8_H_
  #define FONT8x8_H_
  char font8x8_basic[128][8] = {
  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},   // U+0000 (nul)
  { 0x00, 0x00, 0x0,...
  </code></pre>
  
  <p>In vga_util.h</p>
  
  <pre><code>#ifndef VGA_UTIL_H_
  #define VGA_UTIL_H_
   ....
  #include "font8x8_basic.h"
  ...
  </code></pre>
  
  <p>In sensor.h</p>
  
  <pre><code>#ifndef SENSOR_H_
  #define SENSOR_H_
  ...
  #include "vga_util.h"
  </code></pre>
  
  <p>In main.c </p>
  
  <pre><code>#include "vga_util.h"
  #include "sensor.h"
  </code></pre>
  
  <p>My build log looks like this</p>
  
  <pre><code>05:27:22 **** Incremental Build of configuration Nios II for
  project     C_eng_job4 ****
  make all 
  Info: Building ../C_eng_job4_bsp/
  C:/altera_lite/16.0/nios2eds/bin/gnu/H-x86_64-mingw32/bin/make
  --no-print-directory -C ../C_eng_job4_bsp/
  [BSP build complete]
  Info: Compiling main.c to obj/default/main.o
  nios2-elf-gcc -xc -MP -MMD -c -I../C_eng_job4_bsp//HAL/inc
  -    I../C_eng_job4_bsp/ -I../C_eng_job4_bsp//drivers/inc  -pipe -D__hal__
  -DALT_NO_C_PLUS_PLUS -DALT_NO_INSTRUCTION_EMULATION -DALT_USE_SMALL_DRIVERS
  -DSMALL_C_LIB -DALT_SINGLE_THREADED    -O0 -g -Wall -Wpedantic -Werror
  -mno-hw-div -mno-hw-mul -mno-hw-mulx  -o obj/default/main.o main.c
  In file included from vga_util.h:16:0,
               from main.c:31:
  font8x8_basic.h:69:25: error: overflow in implicit constant conversion
  [-  Werror=overflow]
   { 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00},   // U+002A (*)
                       ^
   font8x8_basic.h:122:49: error: overflow in implicit constant conversion
  [-Werror=overflow]
   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF},   // U+005F (_)
                                               ^
  cc1.exe: all warnings being treated as errors
  make: *** [obj/default/main.o] Error 1
  </code></pre>
  
  <p>Complete code can be seen <a href="https://github.com/karagiannis/C_eng_job2/tree/master/HW_C_engjob/HW_C_ingjob/software/C_eng_job4" rel="nofollow noreferrer">here</a> </p>