From: Jan-Benedict G. <jb...@lu...> - 2009-12-29 15:45:45
|
On Mon, 2009-12-28 15:52:25 +0100, Didier GARCIN <dg....@gm...> wrote: > Ordinary, man 3 basename gives a more straightforward method : > > #define _GNU_SOURCE > #include <string.h> That won't guarantee that you get what you asked for. Think about compiling this code with eg. a BSD libc. > But, I don't know why (it's too old in my mind) but I decided to use the > first method. > Perhaps because this last method (with #define _GNU_SOURCE) didn't work with > my soft. Indeed, I can't see any reference to _GNU_SOURCE in string.h. > Mystery ??? No, design. "_GNU_SOURCE" enables a number of features, which in turn activate more defines. This is all hidden within features.h in a GNU libc. However, my hint is: don't rely on GNU functions unless you're forced to. Don't get me wrong, I like those. But they may hinder portability. Unless, of course, you ship a complete GNU libc etc. to whereever your software should run. But "ordinary" software should just run on any system offering a POSIX or ANSI system interface. MfG, JBG -- Jan-Benedict Glaw jb...@lu... +49-172-7608481 Signature of: GDB has a 'break' feature; why doesn't it have 'fix' too? the second : |