Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
qntm
Jun 17, 2009

Presto posted:

This is C/C++, plus is higher precedence than shift

This is a horror.

Adbot
ADBOT LOVES YOU

Jerry Bindle
May 16, 2003

qntm posted:

This is a horror.

The language or the precedence choices?

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

qntm posted:

This is a horror.
There are languages that prioritize shifts over addition/subtaction?

Zhentar
Sep 28, 2003

Brilliant Master Genius

Wheany posted:

code:
//Fixes bug F3EA123-D5
//var foo = "foo";
//var bar = "bar";
var quux = "quux";
return quux + "baz";
That last comment is semi-useful. At least I could open the bug database and search for that bug, but instead the dude could have explained why and what change was made.

It's a trick. If you look up the entry in the bug database, you'll find that the reported bug is "Frank, opened this to track that issue we talked about." The entry is closed with "Successfully reproduced complex, obscure scenario in which issue arises, that I'm not going to document here (or anywhere else). Fixed issue." That, or you open the bug and it's something totally unrelated, because the developer made some mistake typing the ID (optionally followed by half an hour of searching for the correct bug entry, only to find aforementioned "information").

The one I get sometimes around here that drives me nuts is a change will be marked with the ID for an entry in our development tracker that fixes a dozen bugs, none of which have any apparent relation to the change.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Aleksei Vasiliev posted:

There are languages that prioritize shifts over addition/subtaction?

There are languages that have uniform operator precedence rules, at least. Lisp, Forth, PostScript, APL, etc. For the most part people seem to prefer expressions to look like textbook arithmetic for some reason.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

qntm posted:

This is a horror.

values of β will give rise to dom!

qntm
Jun 17, 2009

Aleksei Vasiliev posted:

There are languages that prioritize shifts over addition/subtaction?

I would have thought every language did this. A shift is, after all, a glorified multiplication or division in most cases. But apparently not, and it trips me up every single time.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
From my first post in this thread:

Wheany posted:

Multiplication is a slow operation:
code:
#define SOME_CONSTANT 5
int someValue=SOME_CONSTANT << 2;

Gotta optimize those preprocessor macros and variable initializations!

toiletbrush
May 17, 2010
Just a tiny one, displaying a DateTime in a razor view...

code:
@DateTime.Parse(model.Date.ToString()).ToLongDateString()

wwb
Aug 17, 2004

Please tell me chopped off that guy's thumbs. I keep a cigar cutter handy for that purpose.

Lysandus
Jun 21, 2010

toiletbrush posted:

Just a tiny one, displaying a DateTime in a razor view...

code:
@DateTime.Parse(model.Date.ToString()).ToLongDateString()

So he took a date, made it a string, parsed a date from that string and turned that date into a string...

:psypop:

That's some inception horror there.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Lysandus posted:

So he took a date, made it a string, parsed a date from that string and turned that date into a string...

:psypop:

That's some inception horror there.

I do that sort of thing semi-often when I'm coding late at night, tired, and haven't planned out what I'm doing ahead of time.

I like it because I always get a laugh out of it when I come back the next day to see why my code is weirding out on me.

baquerd
Jul 2, 2007

by FactsAreUseless
Legitimate use when dealing with a database that only takes specifically formatted dates and user design forcing another format, parsing a user string to a date to a string to an sql date. Depending on how the formatting class in use here works and how the original date was obtained (what is this, .NET?) but it looks like that's not quite the same thing and this is still a coding horror.

davejk
Mar 22, 2007

Pillbug

baquerd posted:

Legitimate use when dealing with a database that only takes specifically formatted dates and user design forcing another format, parsing a user string to a date to a string to an sql date. Depending on how the formatting class in use here works and how the original date was obtained (what is this, .NET?) but it looks like that's not quite the same thing and this is still a coding horror.

Razor is the new UI syntax in ASP.NET MVC. It looks like they're turning a DateTime into a string, then parsing that back to a DateTime (resulting in a potential loss of precision depending on their globalization settings), then turning that back into a *different* string to display to the user. It wouldn't even make sense in the context of databases, anyway, because you can just pass the DateTime directly rather than converting it into a string.

One of our projects at work contained something similar, Convert.ToInt32(int.Parse(someInt.ToString())). Gotta make sure it's really, really an int. :downs:

AntiPseudonym
Apr 1, 2007
I EAT BABIES

:dukedog:
This was the very first bug I ever got given when I had just started being a professional programmer.

code:
ASSERT(matrixStack.pop());
How I wish it was possible to have asserts only execute const statements in C++. :sigh:

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
First you'd have to have a sensible concept of a const statement. Even something as simple as dereferencing a pointer can't be removed without potentially effecting the behavior of the program.

Frozen Peach
Aug 25, 2004

garbage man from a garbage can
While not exactly a coding horror... I do have way too much fun when coding scripts and jobs into apps that only I should be able to see/use.



Pushing the button runs (or will run, when I'm done working on it) a conversion job that will translate older MARC records to newer fancier MARC records.

An actual coding horror:

A huge number of our databases have horrible names that weren't changed from the original names on the mainframe. BOOKMASTER being one of them (or more accurately BOOKMST), which is what houses all of our MARC records for books we sell. The app that edits those records was also called the Bookmaster. So when making the new fancy 2.0 version I google image searched for bookmaster and found the Kingdom Hearts 2 character art. :v:

POKEMAN SAM
Jul 8, 2004

Frozen-Solid posted:

A huge number of our databases have horrible names that weren't changed from the original names on the mainframe. BOOKMASTER being one of them (or more accurately BOOKMST), which is what houses all of our MARC records for books we sell. The app that edits those records was also called the Bookmaster. So when making the new fancy 2.0 version I google image searched for bookmaster and found the Kingdom Hearts 2 character art. :v:

Now you've got splash screen material (seriously)!

Frozen Peach
Aug 25, 2004

garbage man from a garbage can

Ugg boots posted:

Now you've got splash screen material (seriously)!

It's the program's icon, though it's hard to tell in that screenshot.

kalleth
Jan 28, 2006

C'mon, just give it a shot
Fun Shoe
Some HTML that I have to GET and parse to scrape some values from. From what appears - on the page - to be tabular data.

.

Thanks, taiwanese coders. Thaiwanoders.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
Let me guess: They used tables for layout.

tef
May 30, 2004

-> some l-system crap ->
this is what css selectors and xpath are for. if your scraping library does not support these, abandon it.

kalleth
Jan 28, 2006

C'mon, just give it a shot
Fun Shoe

tef posted:

this is what css selectors and xpath are for. if your scraping library does not support these, abandon it.

How many identical ID tags are you 'supposed' to have in an HTML document?

Pardot
Jul 25, 2001




kalleth posted:

How many identical ID tags are you 'supposed' to have in an HTML document?

1.

Unless you were being sarcastic, in wich case, congratulations on a trap well sprung.

kalleth
Jan 28, 2006

C'mon, just give it a shot
Fun Shoe

Pardot posted:

1.

Unless you were being sarcastic, in wich case, congratulations on a trap well sprung.

My point was that:

1) Tabular data. That's what tables were invented for. Why shoehorn UL's into a table format using CSS when its... tabular data? Just to avoid tables for the sake of it?
2) The code has about ten identical ID tags against the UL objects.

:(

Also, css selectors on ID in most libraries don't let you iterate through an ID-type selector. It's not that I -can't- traverse it, its that the code made me laugh, then cry, which i thought was the point of the thread :(

Impotence
Nov 8, 2010
Lipstick Apathy
Ghettocode horror: find nd replace 'id=' with 'class=' then iterate through that

Dicky B
Mar 23, 2004

I would guess that somebody just told them "tables are evil!" and forgot to add "except for tabular data!"

kalleth
Jan 28, 2006

C'mon, just give it a shot
Fun Shoe

Biowarfare posted:

Ghettocode horror: find nd replace 'id=' with 'class=' then iterate through that

I used a simple CSS selector based on element type rather than ID/class excepting those with a class i didn't want, seemed to work fine for my application.

Jerry Bindle
May 16, 2003
In the ~Professional~ version of this compiler I'm using for embedded work it tries to optimize the width of pointers based on where the object being pointed to is in memory. For some reason its goofin' pretty bad when I try to use void pointers. So far the only solution is to turn it back to Lite mode and manually set the pointer size to 24-bit, because there isn't a way to turn off pointer size optimization in professional mode

PrBacterio
Jul 19, 2000

dietary supplement posted:

In the ~Professional~ version of this compiler I'm using for embedded work it tries to optimize the width of pointers based on where the object being pointed to is in memory. For some reason its goofin' pretty bad when I try to use void pointers. So far the only solution is to turn it back to Lite mode and manually set the pointer size to 24-bit, because there isn't a way to turn off pointer size optimization in professional mode
What the HELL kind of moon architecture is that supposed to be? :gonk: A 24-bit address space :wtc:? Or is that just for immediate addressing modes with an operand address contained within a 32-bit instruction word, in which case you've probably got your sections all set up in a weird way so that the compiler doesn't know how to handle them.

fishmech
Jul 16, 2006

by VideoGames
Salad Prong

PrBacterio posted:

What the HELL kind of moon architecture is that supposed to be? :gonk: A 24-bit address space :wtc:?

The 286 had a 24 bit address space. The 68EC020 used in the Amiga 1200 had a 24 bit address space available to it too. The 68000 in the original Mac was also limited to a 24 bit address space.

pseudorandom name
May 6, 2007

x86 in 32-bit mode has 48-bit address space pointers, for that matter.

PrBacterio
Jul 19, 2000

fishmech posted:

The 286 had a 24 bit address space. The 68EC020 used in the Amiga 1200 had a 24 bit address space available to it too. The 68000 in the original Mac was also limited to a 24 bit address space.
Well but the 286 *was* in fact a very weird and out-there kind of moon architecture, so my point still stands I think :colbert: But really, I guess you're right. It just always seems so weird when the range of possible memory addresses is not a power of two, at least at first glance :o:

.. in the latter two of your examples it's only the *physical* address space you're talking about anyway. Virtual addresses were still 32 bits in those CPU's, as that was the width of the address registers, I think?

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

PrBacterio posted:

What the HELL kind of moon architecture is that supposed to be? :gonk: A 24-bit address space :wtc:? Or is that just for immediate addressing modes with an operand address contained within a 32-bit instruction word, in which case you've probably got your sections all set up in a weird way so that the compiler doesn't know how to handle them.

Contemporary x86-64 processors have a 48-bit address space:
http://en.wikipedia.org/wiki/X86_64#Virtual_address_space_details

Also in 8086 16 bit mode, the addressing was 16 bit offsets with 16 bit overlapping segments every 4 bits for 20 bit effective addressing.

Jerry Bindle
May 16, 2003

PrBacterio posted:

What the HELL kind of moon architecture is that supposed to be? :gonk: A 24-bit address space :wtc:? Or is that just for immediate addressing modes with an operand address contained within a 32-bit instruction word, in which case you've probably got your sections all set up in a weird way so that the compiler doesn't know how to handle them.

Microchip's PIC18. On die I don't think any part has more than about 4k, but some parts have the option to use external memory blah blah blah.

I just don't know what the compiler wants me to do to be able to use void pointers. It has a lot of quirks that you can get around if you rub it the right way. Like the pic18 doesn't have a linear memory space, so if you want to create an object that spans a page you have to alter the linker script, create a new psect, declare the object as global and access it via a const pointer. FUN.

qntm
Jun 17, 2009
http://en.wikipedia.org/wiki/31-bit

duck monster
Dec 15, 2004

Biowarfare posted:

Ghettocode horror: find nd replace 'id=' with 'class=' then iterate through that

Man I've been dealing with django templates from a graphic designer where there are no classes just ids repeated over and over again
code:
<h1 id="heading">blah</h1>

<p id="paragraph">rara</p>
<p id="paragraph">rarara</p>
etc
etc
Seriously how loving hard is it to understand the difference between an id and a class, and how the gently caress am I supposed to xpath that poo poo sanely.

Worst part is if I change half of them to classes (and the corresponding css) it somehow introduces mysterious subtle layout changes and since I'm completely terrible at CSS (Yet not terrible enough to confuse ids and classes) fixing them has been a real manual-at-side oval office.

kalleth
Jan 28, 2006

C'mon, just give it a shot
Fun Shoe

duck monster posted:

Man I've been dealing with django templates from a graphic designer where there are no classes just ids repeated over and over again
code:
<h1 id="heading">blah</h1>

<p id="paragraph">rara</p>
<p id="paragraph">rarara</p>
etc
etc
Seriously how loving hard is it to understand the difference between an id and a class, and how the gently caress am I supposed to xpath that poo poo sanely.

Worst part is if I change half of them to classes (and the corresponding css) it somehow introduces mysterious subtle layout changes and since I'm completely terrible at CSS (Yet not terrible enough to confuse ids and classes) fixing them has been a real manual-at-side oval office.

:s/id=\"paragraph\"/class=\"paragraph\"/g
:e public/stylesheet.css
:s/#paragraph/.paragraph/g

MononcQc
May 29, 2007

why the gently caress do you need to add a 'paragraph' class to a 'p' element? That's what 'p' stands for already. If you really need to, just do your selectors based on context (#article p { ... } vs. #header p { ... }) and override for the others (#article p.advertisement { ... }). The selector is going to be more precise and take precedence anyway. Get something readable there.

Hatin' on people writing poo poo HTML/CSS.

Adbot
ADBOT LOVES YOU

indulgenthipster
Mar 16, 2004
Make that a pour over
code:
<span class="span1"><span class="span4"><span class="span13">Text</span></span></span>
I recently worked on a site that was full of this crap. Each one of those numbered span classes had completely different styling, it was impossible to figure out what was going on without tearing the entire thing down.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply