Today I have spend considerable time finding a "bug" that can be demonstrated by this simple code:
main.c
#include "func.h"
#include <stdio.h>
void main(){printf("func: %f", getX());}
func.c
#include "func.h"
static float x[2] = {1.0f, 2.0f};
float getX(int n){return x[n];}
func.h
float getX();
and it compiles & links (VS2010 with /W3) without any warning. Sample output from the run is
func: 1.000000
Can someone explain me how it can work if function declaration and definition do not match and why it is not worth to output any warning?
Thanks