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
trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
iret is an interrupt vector return. If I'm understanding this right, it's like a hosed up longjmp.

Adbot
ADBOT LOVES YOU

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

Triple Tech posted:

Often, the source of these horrors is someone trying to do something brilliant, even proper, but not knowing or having a succint/correct way of expressing it.

Example: Duff's Device.

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

Ryouga Inverse posted:

No, Duff's Device is brilliant in every way.

It's an awesome hack... But come on, it's a hack. Using fallthrough like that is an anti-pattern unless you REALLY need the speed, like Tom Duff did. Anyone else using it is just masturbating.

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

MrMoo posted:

The performance can actually be terrible as the increment is quite expensive, I found this out with a basic vector add & multiply. Array offsets work better ([n+1], [n+2], ...).

If you read about the history of the code, Duff was working for Industrial Light & Magic trying to program some kind of video system and the normal while (count--) {*to = *from++;} just wasn't cutting it. He wrote the switch as a forced-hand loop-unroll/jump-table combo. Pretty standard idiom in assembler, he just moved it to C.

But I guess I don't understand your comment; you're saying that a register increment is expensive? inc reg is probably the cheapest op you can perform aside from the nop. Maybe I just don't understand what you mean.

Take into account this was written in 1983, and while there certainly were vector processors back then, I don't think his target was one.

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

MrMoo posted:


The array offsets are free on Intel processors.

Well, it's not equivalent code, but I see your point. FYI, Duff's device needs the jump-table generated by the switch statement because of unaligned data sets. Also, his target was most likely not an Intel 8086 series processor with free index offsets.

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

Victor posted:

Clearly the input should be s and the output should be ret. :colbert:

Why not just r?

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

Victor posted:

I reserve r for Regex instances.

Boo!

I use re for regex. It's far less common than returning a value, so it can get the extra letter.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
I think the wtf there is rolling a DFT in python when FFTW is free.

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

shopvac4christ posted:

An enumeration I found, the values of which are used in a database table.

code:

    public enum FooType 
    {
        Foo = 0,
        Bar = 1,
        Baz = 3,
        Bip = 5,
        Bob = 10,
        Jam = 20
    }

They tried to come up with numbers that they could add together for a combination of options. :haw:


:suicide:

Everything is a Foo!

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

argolithm posted:

But... well:
code:
for(int i = 0; !false && i < word.length(); i++)
This appeared from a class-mate in my data structures class. The constant call of length() isn't a problem at all-- that's insignificant enough to let people do it, I don't care about that.

FYI, I'm almost positive that word.length() call will get optimized into an inline by HotSpot. I actually thought javac would take care of it, but the disassembler says otherwise.

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

tef posted:

Here is a bit of a security coding horror:

This is a goddamn nightmare from the depths of hell itself. We have a lot of jobs that use scp, and a lot of Ubuntu servers. gently caress me :(

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

6174 posted:

What I find interesting from that links.org post is a lot of people are railing on Debian for not contributing the patch upstream, or at least asking upstream if it was an issue. Yet in the comments there is a link to a openssl-dev thread (http://marc.info/?t=114651088900003&r=1&w=2) where they did precisely that and no one mentioned it was a bad idea, and one of the responders, Ulf Möller (listed as a dev team member on http://openssl.org/about/) said he was in favor of removing the calls. Seems to me that at least some of the blame for this should be on OpenSSL.

I agree. This whole thing is a (drat annoying) lesson in how to behave in a public programming ecosystem, IMO.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
There really should be an &= operator or something for referential equality.

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

MrMoo posted:

Well don't these operators map into the extra math symbols, we have =, ≡, and ≣, so you could have === (≡) as data equality, and ==== (≣) for class equality.

I don't have a degree in maths, when would you use "identical to" === (≡) and "strictly equivalent to" ==== (≣)? I just found this for possible usage in OOP:

http://weblog.raganwald.com/2008/04/is-strictly-equivalent-to.html

You're right, it would be &== and not &=.

As for the rest of that, I can't wait for Unicode keyboards. Using proper symbols would be a godsend, not some ==== bullshit. I know you can do Unicode in C# but typing in the codes is a pain in the dick.

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

Scaevolus posted:

I bet he means an APL keyboard.

Additional characters:

\ _ ¨ ¯ × ÷ ← ↑ → ↓ ∆ ∇ ∘ ∣ ∧ ∨
∩ ∪ ∼ ≠ ≤ ≥ ≬ ⊂ ⊃ ⌈ ⌊ ⊤ ⊥ ⋆ ⌶ ⌷
⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇
⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏ ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗
⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧
⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯ ⍰ ⍱ ⍲ ⍳ ⍴ ⍵ ⍶ ⍷
⍸ ⍹ ⍺ ⎕ ○

Let's stick to ASCII.

Look at all those beautiful, succinct glyphs... just waiting to be used :(

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

deimos posted:

Python would like a word with you.

I'd like a word with python.

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

That Turkey Story posted:

Whoa, whoa, backup. Are you saying Java isn't a lovely language?

Oh come on when is this poo poo going to end? It's not that bad.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
I just ran into a class that has a member variable boolean m_immutable;

In every loving mutator function, it tests this, and if it's true, it just returns. For example:

code:
public void setCostMod(double v) {
	if (m_immutable) {
		return;
	}
	m_costMod = v;
}
gently caress me.

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

Evis posted:

That's pretty cool. I take it that it would have to be a type conversion or something? Could you post an example?

It's just the way languages like C handle their if statements. Java specifically decided to not allow it to work that way because of the specter of "ambiguity".

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

Mr. Herlihy posted:

System.String is sealed in the .NET Framework.

And java.lang.String is final. You'd have to facade it, and lose a bunch of syntatic sugar.

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

fansipans posted:

Ugh... why is this page taking forever to load?!?!?


Click here for the full 800x587 image.


oh ..... dammit.
That's loving awesome, it's like old COBOL print lines.

I am in awe.

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

JediGandalf posted:

Probably not exactly hungarian notation but it's along the same lines. I present you our old table and column naming scheme.
code:
select
	c.brand, c.caffeineContent
from
	tblCoffee c with(nolock)
join
	tblCoffeeType ct with(nolock)
	on c.fkCoffeeTypeId = ct.pkCoffeeTypeId
where
	ct.pkCoffeeTypeId = 5 --Decaf
My current lead engineer hates this style. I agree with him. For foreign keys I think [TableName]ID is good enough.

Edit: Missing code tag.
I agree as well. Our tables here are all prefixed with random acronyms of the table names and an optional underscore. It's as awesome as you might suspect.

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

ashgromnies posted:

code:
$color = 'bgcolor="#F' . ($n++ % 2 ? "C9" : "") . '"';
:c00l:

Who wants to go golfing? :)

Instead of doing a modulus, just keep making $n = !$n after the assignment.

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

BigRedDot posted:

Seriously, what is attempting to iterate past the end of a sequence, if not an exceptional circumstance?

The language shouldn't even let you :colbert:

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

Flobbster posted:

the Java compiler is smart enough (that's a phrase you don't hear too often!)
Sun's javac is probably one of the best compilers on earth. Do you have an example of it making poo poo code that breaks HotSpot or something?

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

Painless posted:

GCJ Can't Java

It's getting there:
http://en.wikipedia.org/wiki/Icedtea

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

beuges posted:

:suicide:

This is what the douchebags who wrote the Amazon implementation at my shop did. They were masturbating themselves that they did it in 6 weeks, but maintainance is impossible. It literally takes almost 6 weeks just to fix bugs or update the feeds when Amazon changes the spec.

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

Painless posted:

Yesterday, I was asked "do you know why this crashes?" based on an "application has done terrible things and must die" dialog. I looked at the source, and it looked like this:
code:
int main( void )
{
  #include "initstuff.h"
  //#include "dostuff1.h"
  //#include "dostuff2.h"
  //#include "dostuff3.h"
  #include "dostuff4.h"
  //#include "dostuff5.h"
  //you get the idea, repeat about 50 commented dostuffxx.hs
  #include "shutdown.h"
}
I pressed "debug" and noticed that the main function overflowed the stack. Turns out, the dostuffxy.h that was not commented allocated some enormous arrays on stack. I "fixed" the problem by increasing the initial thread stack reserve size and wept silently.

We have a Java app similar to this at my shop. Holy poo poo, what a pile of garbage. It keeps throwing "out of heap" errors so I keep giving it more. It's amazing in its ability to use way over a gigabyte of RAM to make a 2MB file.

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

weaaddar posted:

I suppose my thread here: http://forums.somethingawful.com/showthread.php?threadid=3061838
Deserves an honorable mention.

To get around the strict typing of C# and to have flexible functions I have to basically work in lowest common denominator (func<object,object> & object) to implement the basics of church numerals.

Here is a sample of some of the "pretty code"
code:
			Func<object, object> PredForSub = (Func<object, object>)(n =>
				Car((ConsPair<Func<object, object>>)Apply((Func<object, object>)n)(z =>
					Cons(Cadr((ConsPair<Func<object, object>>)z),
						Cons(Succ(Cadr((ConsPair<Func<object, object>>)z)), null)))
							(Cons(ChurchZero, Cons(ChurchZero, null)))));

I did something similar in Javascript and it was only slightly more readable. Ugh. Square peg meet round hole.

A line from OsCommerce that I feel really exemplifies the entire project:
code:
      $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);

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

tripwire posted:

There is no god

I think it's more proof that the designers of RFC 822 were not very forward-thinking when they came up with it.

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

McGlockenshire posted:

code:
(int)60D
What?

No, really, my Java is rusty, and I have no idea what in the flying hell this means or is doing. He's casting "60D" to an int. But what the hell is 60D? A constant? I didn't think any sane programming language let you start constants with numbers, though that would also explain the "22D"... and that scares me.

Did this guy learn to code in BASICA, and just never got over insane variables?

xxxxD forces the number xxxx to a double. Can do the same with xxxxF for float.

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

McGlockenshire posted:

But... if it's being created as a double, why is he immediately casting it to an int? And since when have primitive non-decimal numbers been anything but ints? This assumes that the coder thought of this. This code makes my head hurt.

I couldn't even venture a guess. Probably some rear end in a top hat making things more complex than they need be to justify how smart they are.

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

UberJumper posted:


Sigh, is there a better way to do this? I cant stop it from destroying this page.

You could put it in a pastebin, but I think it's worth it to see this poo poo in all its glory.

To be perfectly frank, I feel a lot better about some of the poo poo I've written in a rush or early in my career... nothing was ever this bad.

Also, I personally love this part:
code:
        // Roger wanted me to make sure that this cant happen if it does anyways
	String checkIT = new String(l1.VALUE())
	if(checkIT == NULL)
Did a scientist write this? I've seen some absolute poo poo come out of scientists...

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

Mill Town posted:

Right, but the class still needs to be defined somewhere. Can you do that with reflection, too? I'd like to know! (I like reflection)

You could do it with CGLIB or ASM. With either you can basically class load arbitrary streams of bytecode on the fly and give them arbitrary class names so long as the class can be verified and the name is valid according to the JLS.

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

j4cbo posted:

For what it's worth, even C isn't Turing complete...

The C standard defines recursion, wouldn't that qualify it as being Turing complete (for values of "Turing complete" that incorporate resource limits) despite the data-width issues?

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

rjmccall posted:

C is Turing-complete. Turing-completeness does not require that an unbounded amount of memory be simultaneously addressable; after all, that is not true of Turing machines themselves.

I think it depends on the definition of Turing Complete you use. In the strictest sense, a Universal Turing machine requires an unbounded tape and any resource-limited machine cannot fit that definition.

That said, most people use the looser definition where any language that would be Turing Complete when run on some theoretical unbounded machine is considered TC.

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

rjmccall posted:

Unbounded, not infinite. If you formalize C as running on a theoretical machine with finite memory, then yes, your statement is correct; but if you formalize it as running on a machine with the full capabilities of, say, an IBM PC AT, then its space is theoretically unbounded, because if it runs out of space locally it can pause execution and say "Insert a new disk in drive A:".

Yes but you'd run out of matter eventually. I feel dirty for how pedantic this is getting :(

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

TheSpook posted:

After five minutes of trying to remember lambda calculus . . . can you explain this?

It's the fixed point function, also called the Y-Combinator.

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

Lexical Unit posted:

That was surely their intention, but w/o use strict the bare text false becomes a string literal which evaluates to true :banjo:

more evidence of this:

Shaggar posted:

any language that starts with p is terrible.

Adbot
ADBOT LOVES YOU

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

Janin posted:

our VCS doesn't have atomic commits, so any bug fixes are an all-or-nothing affair

sounds like quittin' time to me

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