5 ms·
Where did you see that exactly? Looked at several headers at random just now (including file, net) and they seem OK. Not terribly verbose, but not exactly cryp
by abcd_f 8y ago
Where did you see that exactly?
Looked at several headers at random just now (including file, net) and they seem OK. Not terribly verbose, but not exactly cryptic.
In terms of 'p' vs 'position' - 'p' is an extreme and it's usually used for pointers, but the driving factor for using shorter names is usually to keep the line length in check when these vars are used in the code. Ditto for type names.
"Position" is quite often shorten to "pos", "offset" to "off", "length" to "len", etc. This is very common. Sometimes the original name is too long (e.g. "position of the last error in the first block") and lands itself to a not-so-obvious abbreviation, in which case the comment is made to clarify what it is.
It's basically about striking a balance between succinctness and verbosity, and conventionally C tends to lean towards the former.
- blattimwind 8y agoThe C++ standard library continued this culture of "making names unreasonably short and/or adding modifiers that are anything but obvious", e.g. rdbuf, setf, seekg/p, tellg/p, beg (instead of begin[ing]), ends etc.
- garaetjjte 8y agoI prefer that instead of boost-like std::chrono::time_point<std::chrono::high_resolution_clock>
- blattimwind 8y agostd::datetime::timepoint<std::datetime::highres> ? Assuming you'd want to keep a separate datetime namespace. Neither ::highres nor ::high_resolution_clock really is a descriptive name though, because it doesn't really describe what it means. What is a "high resolution clock" here? Does it mean µs resolution? Nanoseconds (as some "newer" Linux APIs support)? What about accuracy? "chrono" is one of these "sounds cool but is kind of a weird word to use" things.