The following looks to me like it should just compile. Its one
translation unit so the various inline dances should evaluate to the
same thing. But "Sun C 5.8 Patch 121016-05 2007/01/10" (unless you use
"-features=no%extinl") ends up producing an object with baz() having no
type (nm shows NOTY) and gcc (version 3.4.3 says that about bar().
Whats the right interpretation here? Having plain inline not end up
being the same thing as 'static inline' in this case seems pretty
strange to me. 'extern inline' makes my head hurt. Not sure why
"NOTY" is right in either case although I would guess it is a clue.
FWIW I'm not dieing to push the edge of inline usage but this shows up
in code seen around the world. I'd love to be able to file a bug to
have Sun C do the right thing or to be able to modify code I run across
to do the right thing.
cc:
[Index] Value Size Type Bind Other Shndx Name
[...]
[15] | 0| 21|FUNC |GLOB |0 |4 |bar
[17] | 0| 0|NOTY |GLOB |0 |UNDEF |baz
[3] | 0| 21|FUNC |LOCL |0 |3 |foo
[...]
gcc:
[Index] Value Size Type Bind Other Shndx Name
[...]
[9] | 0| 0|NOTY |GLOB |0 |UNDEF |bar
[7] | 0| 13|FUNC |GLOB |0 |1 |baz
[5] | 58| 13|FUNC |LOCL |0 |1 |foo
[...]
mph
static inline
int foo(void) {
return (0);
}
extern inline
int bar(void) {
return (0);
}
inline
int baz(void) {
return (0);
}
int
main(int argc, char *argv[]) {
foo(); bar(); baz();
}
_______________________________________________
tools-discuss mailing list
[email protected]