drdot
drdot

Reputation: 3347

Is standard behavior relate to gcc version?

Will any of the standard C library behavior be affected by GCC version? One example I am interested in is strncpy() but any other examples would be interesting too.

Upvotes: 3

Views: 98

Answers (1)

P.P
P.P

Reputation: 121387

Will any of the standard C library behavior be affected by GCC version?

Yes, but depends.

It's quite a broad question. There are differences in what gcc supports depending on what version of gcc you are using. gcc has many extensions which are not in standard C (hence not portable if you use those extensions). You could disable most of them with -std=xx -pedantic-errors flag. Assuming you have a gcc version that supports all standard C features(whatever standard you aim for), then additional differences between Standard C vs. POSIX C vs. GNU C vs. Linux specific extensions are usually documented in the manual, which you could consult to determine potential differences or extensions. As for strncpy, there's no difference in behaviour between standard C and GNU C.

Upvotes: 2

Related Questions