It's pretty slick -- although I don't know a lot of recruiters who can convert unix timestamps to actual dates in their heads!
Pasting in code from the internet and running it is a little scary though. I wonder of we can spot the backdoor here. :P
11–20 of 115 posts
It's pretty slick -- although I don't know a lot of recruiters who can convert unix timestamps to actual dates in their heads!
Pasting in code from the internet and running it is a little scary though. I wonder of we can spot the backdoor here. :P
It's pretty slick -- although I don't know a lot of recruiters who can convert unix timestamps to actual dates in their heads!
That's why they run the program, it formats them. Pasting in code from the internet and running it is a little scary though. I wonder of we can spot the backdoor here. :P
Wow, I didn't know this was valid C code, it's pretty convenient. school_t uiuc = { .school = "University of Illinois at Urbana-Champaign", .location = "Urbana, IL", .program = "BS Computer Science", .started = 1251158400, .left = 1336608000, .accomplishments = { "Minor in International Studies in Engineering, Japan", "Focused on systems software courses", NULL } };
It's a C99 feature (I think?) -- designated literals. They're absolutely wonderful.
Code review: * The struct members and variables pointing at string literals should be const. * People do break this all the time but typedefs ending in _t are reserved by POSIX. * Your C99 style struct initializers are valid but it's notable that one popular compiler, MSVC, will not like them. * If we are being idiomatic I would suggest pointer arithmetic to iterate instead of using a counter i.
How exactly is one more idiomatic than the other?
Code review: * The struct members and variables pointing at string literals should be const. * People do break this all the time but typedefs ending in _t are reserved by POSIX. * Your C99 style struct initializers are valid but it's notable that one popular compiler, MSVC, will not like them. * If we are being idiomatic I would suggest pointer arithmetic to iterate instead of using a counter i.
> * If we are being idiomatic I would suggest pointer arithmetic to iterate instead of using a counter i. How exactly is one more idiomatic than the other?
Code review: * The struct members and variables pointing at string literals should be const. * People do break this all the time but typedefs ending in _t are reserved by POSIX. * Your C99 style struct initializers are valid but it's notable that one popular compiler, MSVC, will not like them. * If we are being idiomatic I would suggest pointer arithmetic to iterate instead of using a counter i.
The code compiled fine with MSVC 2013 (simply 'cl resume.c'). No warnings at all.
Earlier quoted context omitted.
> * If we are being idiomatic I would suggest pointer arithmetic to iterate instead of using a counter i. How exactly is one more idiomatic than the other?
It's subjective. It feels more c like and natural to me to write while (foo->bar) and not while (foo[i].bar). The latter feels like the way you would do it somewhere else, grafted onto C. But it's not wrong, I don't have deep qualms with it, and that's why I put it last on my list.
const char **a;
for (a = job->accomplishments; *a; a++)
printf(" - %s\n", *a);
And job_t *j;
for (j = jobs; *j; j++)
print_job(j);
The person who wrote this code seems to dislike `for`s for some reason it seems, these are pretty obvious places to use one IMO, using an index `i` or not. Doing it with a `while` separates out the initialization, condition, and increment in his code, and 'continue' won't work like you normally want it too. initialize
while (test) {
...
increment
}
instead of for (initialize; test; increment) {
...
}