Comments (3)
Can you elaborate on the sense in which you find underscore use excessive? Do you mean the use of underscores at the end of function names?
I'm generally against abbreviations unless they're really necessary. I don't want the reader of the code to have to keep a bigger "dictionary" in their heads, decyphering shorthands and acronyms as they go, and wondering whether they actually mean the same thing as the long version of the name.
'prn' is a common abbreviation of 'print',
No it isn't... I've never seen any library using "prn" instead of "print". Maybe you mean prnf()
? Even that is a bit fishy. If I see it, I would assume it might be somewhat different to printf()
.
Actually, it's bad enough that we have printf()
rather than print_formatted()
or formatted_print()
...
It would make it obvious in applications which use
prnf()
, that they are not using the standard implementation.
- And you believe it is not obvious that
printf_()
is not the standard implementation? - But it would make it non-obvious that they're using something that's compatible with the standard implementation.
printf() could still be overridden by the prnf() implementation, using #defines as it is now.
You can also write prnf()
as a wrapper function around vprintf_()
if you like.
from printf.
from printf.
My rationale for printf_()
is: "This is just like printf()
, but not printf()
from the standard library."
The use of a trailing underscore for "just like but not quite" is common in, well, C++, e.g. when you have a member variable and you want to take an initializer with essentially the same name. So you typically named one of them foo_
and the other foo
, or vice versa.
I'm not buying into prnf()
... but if someone were to suggest a consistent alternative naming scheme for all functions with a rationale, I would seriously consider it.
Regardless - perhaps we can add an entry to the README about how to get whichever name you like with a wrapper.
from printf.
Related Issues (20)
- is there a API to printf vector? HOT 1
- I want to add support for vector format HOT 3
- Possible NULL pointer dereference HOT 9
- Precision not honoured in large double HOT 3
- Rounding-Error: Use proper banker's rounding HOT 4
- Rename `rounding_threshold` to `one_half`
- printf("%# 01.1g", 9.8) results in many 0's due to underflow HOT 1
- printf("%# 01.1g", 9.8) yields decimal rather than exponential formatting HOT 9
- printf still bigger in size compared to stdio printf HOT 14
- print_exponential_number()'s variable "abs_exp10_covered_by_powers_table" may be really uninitialized HOT 1
- suspisious code vs comment HOT 1
- Failing to install a prinf-config.cmake file
- Compiler warning triggered when compiling without -Wmaybe-uninitialized
- Incorrect size assumption for size_t on 16-bit target (msp430). HOT 7
- Two problems about the get_components function HOT 3
- Support long double values HOT 1
- Enable C89 support HOT 11
- Use BUILD_SHARED_LIBS for choosing between static and shared build
- Wrong output of denormalized numbers HOT 4
- float autotest failures HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from printf.