Skip to main content

New answers tagged

9 votes

Efficient file-copying utility using threads

Missing and incorrect error handling The most important problem with your code is that you either don't handle errors, or in some other cases handle them incorrectly. Already at the start of ...
G. Sliepen's user avatar
  • 58.3k
7 votes

Efficient file-copying utility using threads

Do not return a successful exit code on failure: if (argc < 3) return 0; If an incorrect number of arguments were provided, you should return ...
Harith's user avatar
  • 9,050
2 votes

A thread-safe simple logger

Setting the block level could create a data race. Writes to the block level by set_block_level are not synchronized with reads from ...
ComicSansMS's user avatar
4 votes

A thread-safe simple logger

Obsolete typedef enum ... Syntax Only in C, structs/enums/unions inhabited a separate namespace so that you needed to refer to them as ...
uli's user avatar
  • 1,705
10 votes
Accepted

A thread-safe simple logger

printf() and friends are thread-safe While originally the C standard did not mention threads or thread-safety at all, most standard library implementations already ...
G. Sliepen's user avatar
  • 58.3k
3 votes
Accepted

Generic overloading bitwise functions to manipulate the enum type

Consider std::to_underlying You can replace static_cast<udl_type>(a) with ...
Davislor's user avatar
  • 7,956
7 votes

A thread-safe simple logger

Support Logging to any std::ostream Currently, you only log to stdout from the C standard library. It would be better to tell ...
Davislor's user avatar
  • 7,956

Top 50 recent answers are included