|
SurgicalOntologist posted:Last week I called out the prof (my PhD advisor, incidentally) for providing unvectorized example code, I'm pretty sure now he's just trolling me. I wrote that I refuse to do part 2c on principle. Your prof just knows that just like with Suspicious Dish's link to HashPass.php a few posts above, repetition is the key to success in programming.
|
# ? Feb 20, 2014 17:59 |
|
|
# ? May 17, 2024 19:36 |
|
https://github.com/boundarydevices/imx_usb_loader/blob/master/imx_usb.c Look at that horrible pile of poo poo. Why do people release poo poo like this to the public? I have ran into this more than once from companies. Multiple .C files? gently caress that! Variables that mean something? gently caress that! Object oriented? It's C! What's an object?
|
# ? Feb 20, 2014 18:53 |
|
That really doesn't seem all that terrible. Or maybe I'm just jaded by having to look at Asterisk's source code all the time.
|
# ? Feb 20, 2014 19:12 |
|
I hate graphic designers.code:
|
# ? Feb 20, 2014 19:13 |
|
Kilson posted:That really doesn't seem all that terrible. I don't know, I tend to use header files, objects, clearly defined macros, tons of comments, and clean indentation. I also like the format: code:
FlapYoJacks fucked around with this message at 19:42 on Feb 20, 2014 |
# ? Feb 20, 2014 19:37 |
Kilson posted:That really doesn't seem all that terrible.
|
|
# ? Feb 20, 2014 19:52 |
|
ratbert90 posted:https://github.com/boundarydevices/imx_usb_loader/blob/master/imx_usb.c I just skimmed, but that doesn't look like a coding horror, more like a coding nuisance.
|
# ? Feb 20, 2014 19:53 |
|
fritz posted:I just skimmed, but that doesn't look like a coding horror, more like a coding nuisance. Huh, I guess I just don't like giant .c files with little to no comments and variable names that don't mean anything. I guess I am spoiled.
|
# ? Feb 20, 2014 20:04 |
|
code:
|
# ? Feb 20, 2014 20:28 |
|
But it's so much faster than a function! e: Also at the extraneous use of "get_" as prefix.
|
# ? Feb 20, 2014 20:31 |
|
Is there any way to write a generic min() function in C that isn't terrible?
|
# ? Feb 20, 2014 20:52 |
|
vOv posted:Is there any way to write a generic min() function in C that isn't terrible? code:
|
# ? Feb 20, 2014 20:58 |
|
vOv posted:Is there any way to write a generic min() function in C that isn't terrible?
|
# ? Feb 20, 2014 20:59 |
|
Hughlander posted:
You should see Freescales kernel code implimentation. Functions that lead to macros that are built on the fly from other macros.
|
# ? Feb 20, 2014 21:19 |
|
I was going to suggest writing a <? b but apparently that's only a C++ extension in gcc.
|
# ? Feb 20, 2014 21:20 |
|
ExcessBLarg! posted:If your compiler supports the typeof operator and Statement Expressions then you can do something like this: code:
|
# ? Feb 20, 2014 22:20 |
|
I'm no preprocessor guru, butcode:
shrughes fucked around with this message at 22:48 on Feb 20, 2014 |
# ? Feb 20, 2014 22:45 |
|
mjau posted:
|
# ? Feb 20, 2014 23:04 |
|
Suspicious Dish posted:Was trying to book a flight today: What did you end up doing? Did you greasemonkey the page and turn off the validator?
|
# ? Feb 20, 2014 23:07 |
|
Dren posted:What did you end up doing? Did you greasemonkey the page and turn off the validator? Booked a flight on JetBlue instead.
|
# ? Feb 21, 2014 00:12 |
|
autoquit - Automatically quit node.js servers when inactive. OK, that's cool. But why would I ever want to do that? Ruben Vermeersch posted:You should really kill your backend at all times. This forces you to keep state out of it. Keep sessions in Mongo, Redis or memcache. Keep all important state out of the app tier.
|
# ? Feb 21, 2014 00:23 |
|
Makes sense to me.
|
# ? Feb 21, 2014 00:24 |
|
ratbert90 posted:https://github.com/boundarydevices/imx_usb_loader/blob/master/imx_usb.c Its quite nice really, but the aforementioned stupid get_min name and the C89 obsession weak stack handling in clearly C99 code. For some reason the author isn't aware of typedef tags. MrMoo fucked around with this message at 00:28 on Feb 21, 2014 |
# ? Feb 21, 2014 00:25 |
|
Suspicious Dish posted:Makes sense to me.
|
# ? Feb 21, 2014 00:50 |
|
Plorkyeran posted:Does node make it easy to accidentally have persistent state? Another thing that node doesn't make easy is gracefully handling folks who connect to your service just as it's autoquitting. Serving null responses and 504s is kind of rude.
|
# ? Feb 21, 2014 00:56 |
|
Is typeof actually a thing in C11 or whatever. Can you hack it together with _Generic somehow.
|
# ? Feb 21, 2014 01:07 |
|
_Generic is basically just a limited, non-extendable version of function overloading.
|
# ? Feb 21, 2014 01:18 |
|
ExcessBLarg! posted:Not really. I'd imagine that you'd have a load balancer or something in front to distribute HTTP requests to all your internal servers, and know when they're going down ahead of time.
|
# ? Feb 21, 2014 01:24 |
|
In the scenario described there's only a single node instance that's started by systemd when a connection comes in on port 80. It sounds like there's a race condition if a request comes in between when node starts shutting down and when it finishes shutting down, but if you regularly go ten minutes with zero requests to your one instance, that's probably not a big deal anyway. It sounds like mostly just a thing to make your initial deployment setup more similar to a real deployment setup behind a load balancer, and I guess I can get down with that even if the details are kinda goofy. Plorkyeran fucked around with this message at 01:33 on Feb 21, 2014 |
# ? Feb 21, 2014 01:30 |
|
If it's properly socket-activated, then when it starts to shut down, it would immediately unbind the port. In this case, systemd is now listening on the port, and when the server starts back up, it still has all listening connection in the queue and can call accept on them immediately. So, I don't see the race.
|
# ? Feb 21, 2014 01:56 |
|
Suspicious Dish posted:So, I don't see the race. It's more that he proclaims "you should really kill your backend at all times" and provides utterly dubious reasoning, that serves no real purpose on a production machine.
|
# ? Feb 21, 2014 03:18 |
|
Wait were we talking about preprocessor macros? I love those things! Evidently, so does boost!C++ code:
http://www.boost.org/doc/libs/1_49_0/boost/preprocessor/seq/fold_left.hpp Edit: I forgot that the "other similar blocks" involve even worse C++ code:
Jewel fucked around with this message at 03:33 on Feb 21, 2014 |
# ? Feb 21, 2014 03:29 |
|
~summons That Turkey Story~
|
# ? Feb 21, 2014 03:33 |
|
yeah I posted that a while ago and it started the worst argument
|
# ? Feb 21, 2014 03:42 |
|
oh poo poo not this again
|
# ? Feb 21, 2014 03:54 |
|
I forgot we talked about this DON'T START ANYTHING we've done it before see this post if you want to see the discussion on it. Move along
|
# ? Feb 21, 2014 04:11 |
|
What's the point of thecode:
|
# ? Feb 21, 2014 04:34 |
|
vOv posted:What's the point of the It's a preprocessor way of commenting things out.
|
# ? Feb 21, 2014 04:44 |
|
I assume it's there because the actual definition of BOOST_PP_SEQ_FOLD_LEFT on the next line doesn't make it at all obvious what the arguments to it are.
|
# ? Feb 21, 2014 05:16 |
|
|
# ? May 17, 2024 19:36 |
|
e: nope, opera just had the stylesheet hosed up :/
|
# ? Feb 21, 2014 05:42 |