web icon indicating copy to clipboard operation
web copied to clipboard

Outdated coding style recommendations

Open stwunsch opened this issue 4 years ago • 4 comments

The coding conventions are outdated, examples below:

  1. Recommended file header / @(#)root/net / Author: Fons Rademakers 18/12/96
  2. Mandatory method separator: //////////////////////////////////////// (We are doing this??)
  3. Section about namespaces seems outdated/wrong (In ROOT 5 all classes are in the ROOT namespace.)

stwunsch avatar Jun 08 '20 15:06 stwunsch

IMHO several sections at https://root.cern/contribute/coding_conventions should be deleted, they do more harm than good. In particular Avoid raw C types, Exception handling and Namespaces. @couet @Axel-Naumann ping (found this because I wanted to point Ivan at https://root.cern/contribute/coding_conventions , but the page is not useful).

eguiraud avatar Jan 07 '22 15:01 eguiraud

@eguiraud Indeed the namespaces paragraph seems obsolete. The paragraph on Exception is still relevant but maybe need to be clarified/corrected a bit (it tries to say "use exceptions for exceptional case, not to return a value or routine status").

The paragraph on raw c types is still relevant (and probably should even be extended to the new C++ standard type[def]s). It is the case because some of those have different size on different platforms and if stored causes questions/problems (for example if one data on a plaform where they are longer and read it back on another platform where they are shorter). The modern advice should be to use the new C++ standard type[def]s but they are not yet treated as 'special' typedef and actually cause even more trouble for the I/O (see recent removal of size_t from some roofit code).

pcanal avatar Jan 07 '22 23:01 pcanal

The paragraph on raw c types is still relevant

You mean only for I/O-related code, right?

EDIT: nevermind, that's what the content of the section says as well. The title of the section should be mitigated.

eguiraud avatar Jan 09 '22 13:01 eguiraud

You mean only for I/O-related code, right?

yes (well it matters only for I/O but for 'consistency' one might prefer to always use the same pattern)

pcanal avatar Jan 10 '22 15:01 pcanal