TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  7.23.aChecked automatically with code checker

Synopsis:Don't use the functions asctime, ctime and gmtime instead use their re-entrant counterparts asctime_r, ctime_r and gmtime_r.
Language:C
Severity Level:5
Category:Library


Description:

Justification

Non re-entrant functions can cause problems when multiple threads are used or memory is shared between tasks.

Example

char *datestring;
datestring = asctime(&tm); /* WRONG */

char datebuffer[MIN_BUFFER_SIZE]; /* statically allocated */
char *datestring;
datestring = asctime_r(&tm, datebuffer); /* RIGHT */