0
test.c
void __f () { /* Do something. */; }
int f (int) __attribute__ ((weak, alias ("__f")));

test.h
void f ();


main.c
//call f
f();

the __f() and alias f() has different prototype.

use build tools gcc-arm-none-eabi-4_9, no error or warning messages. why,and what will happened?

yyd
  • 33
  • 5
  • In C, `void __f()` is not a prototype at all. It is a function declafation with unspecified arguments. It is compatible with infinitely many prototypes. – n. m. could be an AI Mar 06 '23 at 08:13
  • OT: The name `__f` is invalid in C. All names beginning with double underscore are [reserved](https://en.cppreference.com/w/c/language/identifier#Reserved_identifiers). Defining symbols with such names leads to *undefined behavior*. – Some programmer dude Mar 06 '23 at 14:59

0 Answers0