Is the standard behavior relevant to the gcc version?

Will the GCC version of the behavior affect the standard C library behavior? One example that interests me is this strncpy()

, but any other examples would be interesting as well.

+3


source to share


1 answer


Will the GCC version of the behavior affect the standard C library behavior?

Yes, but it depends.



This is a fairly broad question. There are differences in what gcc supports depending on which version of gcc you are using. gcc has many extensions that are not standard C (hence not portable if you use those extensions). You can disable most of them with a flag -std=xx -pedantic-errors

. Assuming you have a version of gcc that supports all the standard C functions (no matter what you aim for), additional differences between the standard C and POSIX C versus GNU C versus Linux extensions are usually documented in the manual. which you could consult to identify potential differences or extensions. As far as strncpy is concerned, there is no difference in behavior between the C standard and GNU C.

+2


source







All Articles