Skip to content

Commit 3a81664

Browse files
committed
Review fixes
- explain why "long" is deprecated, point out to Wikipedia 64bit data models article. - fix typo
1 parent 1fecf58 commit 3a81664

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

CODING_STANDARDS.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ my_function(thd, db_name);
364364
365365
The usage of types `long` and `unsigned long` (and its `ulong` alias)
366366
in new code is *strongly* discouraged. Its use brings no advantages,
367-
only portability problems between Windows and Unixes.
367+
only portability problems between Windows and Unixes. The reason for it is that `long`
368+
appears to be the only standard C/C++ datatype, with [size that differs between mainstream 64bit OSes](https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models)
368369
369370
Instead of using `long`, use `size_t` and `ptrdiff_t` where appropriate,
370371
buffer sizes for example. For integer socket descriptor use `my_socket`.
@@ -376,4 +377,4 @@ You may use types with fixed length, int32_t and similar, too. Yet, on all platf
376377
* `long long` is 64bit
377378
378379
and the above is not likely to change for the decades to come. Those types are safe to use. When using `char`
379-
though, be aware that its signdness can depend on compiler flags, so do not assume it can take negative values.
380+
though, be aware that its signed-ness can depend on compiler flags, so do not assume it can take negative values.

0 commit comments

Comments
 (0)