-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Rework gigasecond to be slightly more challenging #925
Conversation
@wolf99 how does this submission meet your concerns? |
@@ -1,6 +1,8 @@ | |||
#include "test-framework/unity.h" | |||
#include "gigasecond.h" | |||
|
|||
#define BUFFER_SIZE 20 // "YYYY-mm-dd HH:MM:SS" |
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.
#define BUFFER_SIZE 20 // "YYYY-mm-dd HH:MM:SS" | |
#define BUFFER_SIZE (strlen("YYYY-mm-dd HH:MM:SS") + 1) |
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.
Alternatively: #define BUFFER_SIZE sizeof("YYYY-mm-dd HH:MM:SS")
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.
Alternatively:
#define BUFFER_SIZE sizeof("YYYY-mm-dd HH:MM:SS")
That's much better! I don't know why that never occurred to me.
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.
Should it be a static size_t
instead of a #define so it only needs to be calculated once?
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.
It will be calculated at compile time even if it's a #define
.
Can you bump up the difficulty for |
I was totally Chesterton's Fencing with that construct_date function. Didn't understand why it's there, didn't complain about it ;) |
Thanks for this PR @glennj ! |
I'm not terribly experienced in C. Have I implemented an OK way to handle strings without malloc/free?
Closes #924