|
But we're talking about languages, independent of any real-life machines. It's what the grammar can express that we're interested in, and not technicalities like sizeof(void*) or memory addressibility.
|
# ¿ Apr 13, 2009 15:28 |
|
|
# ¿ May 10, 2024 03:13 |
|
Munkeymon posted:Wouldn't a pass-by-reference system be the best generic way to do it in Perl if you want people to be able to, say, sort an array of arrays by the lengths of the constituent arrays? code:
|
# ¿ Jun 16, 2009 16:48 |
|
That pleb coder, he neglects the case where p_destination is both not equal to zero and not not equal to zero
|
# ¿ Jun 27, 2009 23:49 |
|
BigRedDot posted:So I don't work for Lockheed Martin, but I have to work with Lockheed Martin. Let me summarize their approach to testing/debugging:
|
# ¿ Jul 5, 2009 16:19 |
|
Even though obfuscated code is arguably not an intentional coding horror, I was reminded of this hilarious rock-paper-scissors bot from my AI class a few years back:code:
code:
|
# ¿ Jul 6, 2009 17:57 |
|
To say nothing of that ridiculous switch statement could be removed (edit: or at least simplified) if the author had known about fls()
Dijkstracula fucked around with this message at 21:03 on Jul 7, 2009 |
# ¿ Jul 7, 2009 21:01 |
|
Otto Skorzeny posted:Did he specify he was on a BSD? ffs(3) and its extensions are in POSIX.1-2001, but fls(3) and friends are BSD-specific from what I can tell. edit:
|
# ¿ Jul 8, 2009 02:58 |
|
the dd and sed one is the only amusing "win" on that page; all the others are just spamming anonymous functions.
|
# ¿ Jul 9, 2009 19:15 |
|
That piece of code is incredible. At first glance it only looks moderately silly, but the more I stare at it, the more hidden horrors reveal themselves, like the blossoming of an enormous carrion flower.
|
# ¿ Jul 21, 2009 17:25 |
|
so this xkcd is an internet comic strip, you say
|
# ¿ Jul 22, 2009 06:23 |
|
Lexical Unit posted:Haha, same file:
|
# ¿ Jul 23, 2009 22:08 |
|
Otto Skorzeny posted:Yeah, on a second look I read the parens wrong
|
# ¿ Jul 24, 2009 14:46 |
|
Avenging Dentist posted:For people who think that ants are a silly or irrelevant species, they're not. There are literally 142857 times as many ants in the world than there are humans.
|
# ¿ Jul 26, 2009 07:15 |
|
floWenoL posted:(I still can't decide whether you're trolling or not.)
|
# ¿ Jul 28, 2009 05:18 |
|
I admit I can't even imagine why an implementation of TSP (or, even any of its variants - bitonic TSP, euclidean TSP, etc) would take anywhere near 3000 lines
|
# ¿ Jul 30, 2009 17:45 |
|
quote:I've been lucky to be ahead of the curve since I got into this whole social media thing early. Yay me! quadreb posted:"Moved on"? Regular expressions are an integral part of modern business programming. Also, regular expressions in Java are so terribly loving broken, I don't know if there's any correlation between them and "business programming". edit: Also also, regexes aren't hard to understand, and if you think they are then you are dumb
|
# ¿ Aug 1, 2009 18:03 |
|
BigRedDot posted:I work on sonar systems for submarines, I can say confidently that regular expressions are not at all an integral part of the programming we do. edit: But seriously, folks. It might not be used in every single program that you write, but people can't deny that its only use is to tabulate reports or whatever. String matching is important and common. edit 2: TSDK, would you also say that people should only be allowed near a context-free language if they can distinguish it from a context-sensitive language, and prove it using the equivilent context-free pumping lemma? Dijkstracula fucked around with this message at 18:36 on Aug 1, 2009 |
# ¿ Aug 1, 2009 18:27 |
|
TSDK posted:Okay, so the regex was a bit of a light troll on my part (especially the pumping lemma proof), but DFAs aren't exactly difficult. I would expect any decent programmer to be able to grasp the fundamentals without too much trouble. Also, as Flobbster said, regular expressions in practice aren't DFAs anyway. Perl's maximal matching via backtracking behaves more like an NFA, and the moment you start dealing with ERA stuff like backreferences, you've thrown yourself out of the regular world altogether. Given that, does it really make sense for every person to read the first fifty pages of Sipser or Aho/Hopcroft anyway?
|
# ¿ Aug 1, 2009 18:41 |
|
enki42 posted:Stuff like language theory is probably important for an architect, but if a dev is told they are going to be using a regular expression, it's nowhere near a necessity. (I say this only because I know a guy who spent hours trying to write a regex to match something along the lines of "anbn", which is pretty much the canonical non-regular language.)
|
# ¿ Aug 1, 2009 22:43 |
|
wolf_man posted:for loops are better optimized and efficient then do whiles.
|
# ¿ Aug 22, 2009 04:06 |
|
necrobobsledder posted:Maybe it was to compete for Fortran users or something? code:
|
# ¿ Sep 18, 2009 04:39 |
|
Avenging Dentist posted:Guys, the a[i] / i[a] equivalence is just because the standard defines a[i] as being equivalent to *(a+i). Was this not the case back in the good old days? Were all data types 16 bits on the PDP-11 or something?
|
# ¿ Sep 19, 2009 05:44 |
|
Avenging Dentist posted:You may want to read up on your pointer arithmetic. sizeof(float) = 4 (a + 0) = 0x7fff5fbff850 (a + 1) = 0x7fff5fbff854 (a + 2) = 0x7fff5fbff858 (a + 3) = 0x7fff5fbff85c (a + 4) = 0x7fff5fbff860 sizeof(void) = 1 (b + 0) = 0x7fff5fbff850 (b + 1) = 0x7fff5fbff851 (b + 2) = 0x7fff5fbff852 (b + 3) = 0x7fff5fbff853 (b + 4) = 0x7fff5fbff854 Dijkstracula fucked around with this message at 08:15 on Sep 19, 2009 |
# ¿ Sep 19, 2009 07:59 |
|
I believe we should be exploiting jump tables in a switch statement for maximum fastness code:
|
# ¿ Oct 10, 2009 22:00 |
|
Seriously, I'm pretty sure the Dragon text devoted an entire chapter to fending off mythical beasts or something
|
# ¿ Oct 19, 2009 15:55 |
|
Or grep for it after running gcc -E and see if it's getting inserted into an unexpected place.
|
# ¿ Oct 20, 2009 01:17 |
|
PT6A posted:There are three parts to the assignment/series of assignments: simulate a hard disk (read_block, write_block, etc...) with and without cache (LRU cache replacement), then implement a basic (highly restricted) FAT filesystem, and then allow that basic filesystem to be accessed across a network. Other than correctness, there are no requirements (i.e. it can be as inefficient as you like). Given those constraints, I don't think it's unreasonable to expect 3rd-years to complete the assignments in C, given approximately a month to finish each stage.
|
# ¿ Nov 29, 2009 03:40 |
|
MEAT TREAT posted:Perhaps, but how is that a coding horror in any way?
|
# ¿ Nov 29, 2009 03:41 |
|
HFX posted:Usually, the best code comes from guys who regularly use functional or declarative languages.
|
# ¿ Nov 29, 2009 06:00 |
|
Wow thank you so much for showing me this magic of "recursion"! This is indeed a beautiful thing that is unique to functional languages let me go grab GHC and convert all my code to monads Like, really? That's your counterexample? You don't show off higher-order functions or lambdas and say "can your C do that? Look at what I can do with map and foldr!" But, my entire complaint about functional programming acolytes (where my Reddit circlejerk comment came from) was actually this: jandrese posted:And of course because it's a functional language, it will only be natural to you if you're a mathematician and you would rather be writing proofs instead of code. Just for the record, I still do a lot of programming in functional languages, and it is indeed cool. (and, indeed, I'm TAing a freshman CS class this term that uses Scheme, and the average quality of code that I see in that class is far higher than what I saw in the other freshman Java class.) But you're loving kidding yourself if you try and correlate a language's "quality" with a self-serving "you must be this smart to enter" metric. And further, you can't compare the "average quality" of code of a language that isn't used in a production setting, with one that is. If Java wasn't used by every half-assed developer and his dog to slap together some lovely business app, then you too could probably look at the average piece of Java code and say, "yes, this is beautifully written."
|
# ¿ Nov 29, 2009 09:22 |
|
It's a pretty common thing. I did a very similar assignment at the University of Alberta (the LRU cache simulation, but no file system simulation stuff)
|
# ¿ Nov 29, 2009 09:53 |
|
It's interesting to see so many McGill CS types in here - COMP 202 was the class that inspired me to drop my music degree and go into CS jandrese posted:Way to miss the point. The example there was to show off the weirdness that is running pattern matches on your function calls, the recursion bit was just there because that's how Erlang works! This, actually, proves my point - so many people on the net proselytize the flavour-of-the-week functional language and yet so few have clearly actually used it for anything beyond copying the code examples out of Joe Armstrong's book. Anyway. To give a less snotty answer, no, I didn't miss the point. Yes, the pattern matching stuff in Erlang is very cool, but every single other person in this thread saw it with Prolog in their third year of uni, so we don't feel the need to extol the virtues of a programming paradigm that isn't news to us. It's the whole "to a carpenter with a new hammer, everything looks like a nail" maxim. (additionally, most scheme implementations actually have compound datatypes, though IIRC it's not part of the language spec - in PLT Scheme, for instance, it's defined through the (make-struct ...) construct.) edit: Dijkstracula fucked around with this message at 20:55 on Nov 29, 2009 |
# ¿ Nov 29, 2009 20:52 |
|
jandrese posted:What are you talking about? Have you confused me with someone else? quote:In Pseudocode because I can't remember the wacky syntax:
|
# ¿ Nov 29, 2009 21:13 |
|
Mustach posted:Is this a "lol they suck?"
|
# ¿ Nov 30, 2009 23:41 |
|
yaoi prophet posted:
|
# ¿ Dec 1, 2009 23:20 |
|
dis astranagant posted:No one sane uses an integer for radians. #define 2PI 6
|
# ¿ Dec 8, 2009 05:03 |
|
king_kilr posted:[url]http://74.125.95.132/search?q=cache:2HHNAk2SB6EJ:https://www.codinghorror.com/blog/archives/001045.html+site:codinghorror.com+backup&cd=1&hl=en&ct=clnk&gl=us&client=firefox-a[/url] quote:If you're using Linux, it's something a lot like that. If you're using Windows, go f*ck yourself.
|
# ¿ Dec 11, 2009 23:08 |
|
Panic! at the Fist Jab posted:you're a retard, he was quoting jwz, who *does* unequivocally own It's not like it takes any special skill to come up with something like that.
|
# ¿ Dec 11, 2009 23:15 |
|
Yakattak posted:That's fairly reasonable as long as it's in a loop, as you rarely ever need to know what that variable is, usually because it's scope is only within the loop. I don't use i however, I use count, because I seem to always miss i when reading code. (please don't say "count2" )
|
# ¿ Jan 1, 2010 01:26 |
|
|
# ¿ May 10, 2024 03:13 |
|
RussianManiac posted:http://forums.thedailywtf.com/forums/t/13917.aspx?PageIndex=1
|
# ¿ Jan 1, 2010 21:58 |