-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decimal as String conversion functions #17
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- What's the point of passing integer and unsigned integer arguments by reference in
to_string
and other functions? - Please format all function names and variable names in boost notation style (i.e.
function_name()
instead offunctionName()
andint var_name
instead ofint varName
). - in
to_string()
please don't usesnprintf()
- it's very slow. You can useutxx::itoa()
instead. - Your other functions use strcpy and strlen, however, it's not guaranteed that the string will have '\0' terminator. Especially if the
a_terminator
is passed as something other than '\0'.
|
It depends on what you were measuring. If the cost measure is memory usage, pass by copy is less efficient, and if the cost measure is performance, then using a reference involves an extra dereferencing operation, which is always slower. gcc has an option |
Understood. Valid point, I'll make the correction. |
Preliminary feedback. Not sure how you want to utilize templates for these functions and if the deliminator or terminator is necessary.
Ex.
//template
char a_terminator = '\0'