|
chocojosh posted:We couldn't have just used the ? operator? The person who wrote that probably cut their teeth with VB6 and wasn't aware of the ?: operator. VB6 didn't have a dedicated short-circuiting inline conditional operator, but it included a (non-short-circuiting IIRC) IIF function that worked like the one you posted. Mr.Radar fucked around with this message at 16:35 on May 7, 2008 |
# ¿ May 7, 2008 16:33 |
|
|
# ¿ May 22, 2024 08:45 |
|
ehnus posted:Encountered today: code:
|
# ¿ Apr 14, 2010 07:17 |
|
Lysandus posted:This isn't so much a horror, as it just bugs me. If that code is from a library for a high-level language (e.g. Python) which is wrapping a C library it's probably named like that because that's what the C constant was named.
|
# ¿ Oct 14, 2010 20:35 |
|
Wheany posted:But at some point, PHP didn't have an ecosystem or a user base. At that time, wasn't the choice for web scripting pretty much between PHP, Perl 5.0, TCL, and C (yes, people wrote CGI programs in C) where PHP handled CGI and (to some extent) templating for you while the others made you do it all yourself? In that context, PHP was the sane choice. Mr.Radar fucked around with this message at 03:16 on Dec 12, 2010 |
# ¿ Dec 12, 2010 03:11 |
|
Orzo posted:Why? If you really don't know anything about programming, there are certain things you need to understand before method signatures, access modifiers, and argument lists. Have you ever tried to teach any programming to a complete newbie? The entrypoint signature can be overwhelming. Even many introductory books say 'we'll come back to this later, but for now you always need to have this block of code for your program to run.' But at the same time there are languages like Scheme and Python where you don't need to worry about those things at all. The real horror is teaching Java as a first language.
|
# ¿ May 20, 2011 15:33 |
|
It also uses memset to force the system to actually allocate the memory pages rather than just promising to (as most modern systems do when you call malloc).
|
# ¿ Jun 15, 2011 15:44 |
|
TasteMyHouse posted:Apparently that code triggers a warning, "double is not assignable to int" http://try-dart-lang.appspot.com/s/_44V That's because / is the floating-point division operator. The integer division operator is ~/.
|
# ¿ Oct 11, 2011 14:50 |
|
Zhentar posted:The T_#_SECONDS appear stupid, but they only make up 101 lines out of 1208, and are presumably only there for symmetry with non-seconds definitions. T_7_DAYS on the other hand, is obviously more understandable than 25200, less error prone than 60*60*24*7, and faster than doing the math at runtime with a library, as justified in the README. They could done macros that calculated the seconds from given time periods, e.g. code:
|
# ¿ Feb 1, 2012 19:27 |
|
Look Around You posted:I would like to know how they are going to a) use macros in a language which has none and b) rely on compilation optimization in a language which is not compiled. Oops. I got confused by Dicky B's post into thinking the original code was C. Edit: of course, the answer is to preprocess their Ruby source code with the C preprocessor Mr.Radar fucked around with this message at 20:40 on Feb 1, 2012 |
# ¿ Feb 1, 2012 20:37 |
|
rjmccall posted:Which would, of course, not work, because it's not like the C preprocessor does constant folding either (except to resolve #if conditions). Hence the (well, and the fact that Ruby syntax is different enough from C syntax to make it unlikely that most ruby code could be preprocessed correctly if at all).
|
# ¿ Feb 1, 2012 21:35 |
|
So in Visual Studio 2013 Microsoft is finally adding the most useful features of C99/C11 that everyone else has supported since forever. I would be over the moon on this if I weren't stuck using Visual Studio 2005 for C development at my job. "Well that's pretty old, wouldn't they be moving to 2013 pretty soon then?" Yes, if they hadn't just started transitioning to 2010 shortly after I was hired in 2011 which is still ongoing (I'm told we can expect the first customer shipments of builds with 2010 late next year or early 2015). At this pace I'm expecting I'll finally be able to start coding against a language standard younger than I am at work in about 15 or so years .
|
# ¿ Sep 13, 2013 01:01 |
|
astr0man posted:I'm in a shop that still uses VS2005 as well. We might transition to 2010 next year, but even if we do we'll still have to stick with C89 anyways, which really isn't that terrible of a requirement. Yeah, I was exaggerating a bit about bad it is, but it's still frustrating when Microsoft's pigheadedness about native development over the past decade (particularly C development) is the only reason I haven't been able to use C99 features to add extra safety to my code (it forces me to give my variables more scope than I would like to and prevents me from using const in some places), plus the horror that I still won't be able to until we drop 2005 and 2010 which will take way too long. Of course we also still use CVS and it doesn't seem that bad either (given the business practices we've developed around it) so I may not have the clearest perspective .
|
# ¿ Sep 13, 2013 18:15 |
|
|
# ¿ May 22, 2024 08:45 |
|
Plorkyeran posted:The entire point of the ten-day deadline was to get it into production before the alternative far worse scripting language being worked on. Could you elaborate? I've never heard that there was something even worse than JavaScript that was being pushed and Wikipedia and Google aren't turning anything up.
|
# ¿ Mar 8, 2014 05:21 |