|
Bonus posted:Ultimate variable naming scheme code:
One of the creators of the MUD had a penchant for naming variables things like bing, blue, rabbit, or womble; and his RCS comments half the time are something like "fixed up the thingy a bit". I think he works for Google now. (If you're reading this, Hi David!)
|
# ¿ Mar 31, 2008 22:21 |
|
|
# ¿ May 8, 2024 03:58 |
|
Painless posted:That's pretty likely to go boom on GCC FYI
|
# ¿ Jan 7, 2009 17:49 |
|
Painless posted:It won't "bitch", but it's quite possible that it will randomly fail! Just use unions drat it. Jeet chirst this is making me so angry. What nubbery.. code:
|
# ¿ Jan 8, 2009 20:43 |
|
Just now found a classic: code:
|
# ¿ May 8, 2009 23:34 |
|
Not UNIX posted:Are you using AS2 or AS3? The definition in AS2 is public static get([index:Number]) : Camera, and in AS3, it's getCamera(name:String = null):Camera. Adobe posted:name:String (default = null) — Specifies which camera to get, as determined from the array returned by the names property. For most applications, get the default camera by omitting this parameter. To specify a value for this parameter, use the string representation of the zero-based index position within the Camera.names array. For example, to specify the third camera in the array, use Camera.getCamera("2").
|
# ¿ May 20, 2009 01:06 |
|
Flobbster posted:Sadly I was never able to figure out how to duplicate it reliably. Sometimes forcing -O0 would fix it, but then on another student's code it would be broken under -O0 but -O3 would work instead. code:
I ended up having to declare somevar volatile to fool the optimizer.
|
# ¿ Oct 20, 2009 05:01 |
|
No Safe Word posted:What is an unaigned int ??
|
# ¿ Nov 6, 2009 21:56 |
|
code:
code:
|
# ¿ Dec 17, 2009 18:12 |
|
mr_jim posted:This thread just came full circle. Forgot about this part too: double dzero = (double)0.0;
|
# ¿ Dec 18, 2009 01:40 |
|
BigRedDot posted:
The real horror to me with this one is that I know exactly how it was obtained, because I had to write a slew of code identical to this. You're digging your way down through a pile of auto-generated code to get the thing out that you actually want.
|
# ¿ Sep 22, 2010 21:03 |
|
Pardot posted:and so on up to arg249
|
# ¿ Nov 30, 2010 06:52 |
|
Scaevolus posted:"<< 1" instead of "* 2" is generally a horror. Well, assuming this is C/C++, plus is higher precedence than shift, so what that actually does is code:
|
# ¿ Jul 13, 2011 18:07 |
|
dietary supplement posted:Edit: I had tested it with 2* in there, but then switched it to <<1 because I'm so clever!!
|
# ¿ Jul 13, 2011 18:25 |
|
angrytech posted:If you are using an IDE that doesn't allow you to set the number of spaces defined by a tab, then you a scrub.
|
# ¿ Jul 30, 2011 17:53 |
|
Volte posted:If you ever come to a point where you think "A goto would be really easy here, otherwise I'll have to add in a bunch of boolean flags and conditionals to code my way around it" and then add in the boolean flags and conditionals, you're doing it wrong
|
# ¿ Sep 8, 2011 05:41 |
|
Internet Janitor posted:to this. Does anybody still intentionally write method signatures like that? What is the deal with that hostent pointer? You shouldn't be calling it now anyway because it's obsolete (so I guess it's a good thing it wasn't used). Use getnameinfo instead.
|
# ¿ Sep 25, 2011 05:14 |
|
SlightlyMadman posted:I can't remember for the life of me, but I was working with some horrible scripting language not long ago that would actually throw AN ERROR if you tried to do that CORRECTLY. Declaring "int i" a second time would tell you that i was already defined. I ended up having to declare all of my iterators at the top of the function.
|
# ¿ Oct 19, 2011 05:45 |
|
Look Around You posted:
You can do similar things in makefiles. I've made use of it. It's kind of like driving to work in a tank. It makes some things much easier, but it's likely to end in disaster.
|
# ¿ Feb 14, 2012 19:13 |
|
seiken posted:I kind of agree in principle but really references are an awesome language feature and IDEs these days should totally be able to pop up a signature with the &s there for you to see as soon as you type the ( (I don't like references.)
|
# ¿ Feb 16, 2012 05:16 |
|
DStecks posted:The typo had no tag. This typo had been undetected and part of a program that ran every day, and somehow never caused an abort, in 20 years. It's a funny business.
|
# ¿ Sep 16, 2012 22:16 |
|
bucketmouse posted:Also regarding the hello world chat: I the only one who considers C++ streams a horror in the context of people learning to program?
|
# ¿ Dec 11, 2012 18:45 |
|
beoba posted:Just be glad you aren't using ClearCase. I left a place in 2010 which was still using it at the time. Here's a brief summary of a typical user experience:
|
# ¿ Dec 28, 2012 19:23 |
|
code:
|
# ¿ Mar 20, 2013 19:49 |
|
baquerd posted:Other than readability, I just don't see a huge problem here. Volmarias posted:Edit:
|
# ¿ Mar 20, 2013 22:11 |
|
QuarkJets posted:It's exactly for the reasons that you say; the older crowd wants to keep using FORTRAN and IDL because that's what they've always used, whereas the younger crowd wants to use Python and C++ because it's what they learned in school (and a lot of other reasons) Long story short, we eventually got it all converted to C. It still wasn't pretty, but it was better. We offered the C version back to the group who provided the original Fortran source. They didn't want it.
|
# ¿ Apr 14, 2013 17:51 |
|
evensevenone posted:You have to realized that anyone still working in FORTRAN has been told by well-meaning-individuals who don't actually know what they are talking about that "C (or C++ or Java or Python or Boost) is better" for literally 40 years now.
|
# ¿ Apr 15, 2013 17:33 |
|
Sailor_Spoon posted:Also, git is the best.
|
# ¿ Apr 17, 2013 23:28 |
|
Doctor w-rw-rw- posted:Though, frankly, the idea of most people using Git actually cargo-culting based off of some other DVCS instead of learning how it works is a horror. The other problem is that it's insidious. Every time I think I finally have a handle on it, it does something that I can't fathom. "OK, I'll just do a pull here and... wait, how can I have a merge conflict in a file that I haven't loving touched?" And if you gently caress something up with git, then God help you. We used to use CVS, and yeah, it's primitive; but if something got trashed at least I could fix it manually if I had to. Now my work computer is littered with directories called things like "wtf.git", "git.poo poo", and "fuckyougit" because usually it's just easier to clone the repository again and start over than to figure out how to undo whatever just happened because I cast the wrong git spell. Not to mention the commits I have with a comment like "WTF just happened?" Right now I just have a series of commands that I follow that I don't really understand, but that do what I want. Hooray for cargo cult revision control!
|
# ¿ Apr 19, 2013 06:02 |
|
Gazpacho posted:This can happen if you have your editor set up to mess with files when opening them (or when saving them without any changes), or you're in the habit of committing files without doing a once-over review of what you're committing, or if you did the once over and committed irrelevant changes while giving no fucks. quote:Whatever the case may be, git provides you the necessary diff tracking to find out what happened and learn from it so you should do that. And god help you if you believe hacking a CVS repo is a reasonable recovery option. And once I had git completely throw away a whole bunch of commits I had just done like they never existed. I'm sure it was something I did, but there's no way to figure out what. Look, I'm just a CVS guy trapped in a git world, OK?
|
# ¿ Apr 20, 2013 19:11 |
|
Flobbster posted:CEs can't teach proper programming or software design in my experience, and they have the tendency to (try to) prematurely optimize because they're thinking about the hardware too much instead of trusting the compiler.
|
# ¿ Jun 18, 2013 21:42 |
|
b0lt posted:Sounds like you have some ~undefined behavior~ The good news is that it's 3rd-party code, so if it's broken I take no responsibility. But I'm still pretty sure it's g++ loving up again. I've had problems with the optimizer before in an older version where it decided a comparison was not needed when it quite obviously was. (And no, it wasn't ~undefined behavior~.)
|
# ¿ Jun 19, 2013 01:19 |
|
That Turkey Story posted:It's not unheard of for an optimization to screw up, though if it's eliminating a comparison I have to ask -- was the code dealing with threads? There are some "bad" idioms dealing with threads that are still probably commonly used but that inadvertently rely on undefined behavior (specifically people relying on volatile to do more than what the standard actually says). A comparison not being performed when a programmer expects that it would could definitely be a symptom of this. Nope, this was something very simple in a single-threaded app. It was 1. compute new_sum; 2. if (new_sum != old_sum) { do stuff } else { never mind } The 'if' was getting totally ignored. If you put any additional reference to new_sum in the code, like printing it out, then it worked correctly again. I ended up making new_sum volatile. I think the next gcc revision fixed it (this was somewhere early in the 4.x series I believe) and later the code got rewritten anyway. I've been unlucky with this kind of stuff throughout my career. One time we had code on a DSP that was failing inexplicably, and we chased our tails for a good while until one of the developers figured out a reproducible case, which got sent to our vendor, who pared the case down further to a couple machine instructions and sent it to the chip manufacturer, who said, "Oh yeah, that's a bug in the processor". This is why I'm old and bitter and distrust all software and hardware.
|
# ¿ Jun 19, 2013 18:59 |
|
quote:You just have to memorize these names. Sorry. No, actually I don't.
|
# ¿ Sep 24, 2013 19:37 |
|
My Rhythmic Crotch posted:Each directory had a Makefile inside it - something I have never seen before or since.
|
# ¿ Nov 2, 2013 23:42 |
|
Plorkyeran posted:Recursive make is kind of terrible (it has a lot of overhead, doesn't track dependencies very well, and doesn't parallelize very well)
|
# ¿ Nov 3, 2013 22:38 |
|
revmoo posted:Git is amazing as long as you don't have coworkers that read HackerNews 24/7 and get distracted by every shiny new thing and come up with ridiculously outlandish branching and merging processes. Then you end up with things that belong in this thread.
|
# ¿ Apr 24, 2014 06:20 |
|
Also, people had been using hacks for concatenation like #define GLUE(a, b) a/**/b. But then they standardized on comments being replaced with a single space, which meant they needed some formal way to do concatenation, which begat ##.
|
# ¿ Mar 27, 2015 17:38 |
|
Ithaqua posted:Back to the original "horror": I don't know why it's a horror that every story is 3 points. That can happen.
|
# ¿ Sep 25, 2015 16:57 |
|
Ithaqua posted:You're going to be the person working on the thing in a few days; would you prefer that an arbitrary estimate was handed down by someone who had no clue?
|
# ¿ Sep 25, 2015 17:17 |
|
|
# ¿ May 8, 2024 03:58 |
|
Ithaqua posted:If I give an estimate and it sucks, it's my own drat fault. As someone with my head in the codebase, when I give an estimate, I'm at least likely to be in the right ballpark, not wildly high or wildly low. This is probably where someone will say "then you need to hire more people and break the project into smaller chunks!" Yep, and I would like a Lamborghini too.
|
# ¿ Sep 28, 2015 18:55 |