|
Rather cold in here...
Last post 11-19-2008 11:38 AM by Fred Foobar. 23 replies.
-
10-28-2008 2:24 PM
|
|
-
Vechni


- Joined on 09-12-2007
- Baltimore, MD
- Posts 124
|
So, I'll show this simple code I use, but if someone else were to find it, they would definetly see a WTF.... public class Heater { public static void main(String[ args) { new Heater(); }
public Heater() { int i = 1; while (true) { i = i * 2 - 50; } } } I run this code once a day because it's a tad chilly in my cubicle. Don't really plan on spending the money on a space heater. Recently moved north and haven't bought much winter clothes yet.
|
|
-
-
BlueKnot


- Joined on 10-17-2007
- Posts 43
|
Re: Rather cold in here...
Um... yeah... well, if you're counting on that to overheat your chips to defrost your frostbitten appendages, you'd better be running on some very cheap equipment with no heat sink, because that will overflow and throw an out of range exception fairly quickly I think.
And yeah... what morbius said.
- Dan
|
|
-
-
Aaron


- Joined on 07-10-2007
- Posts 239
|
Re: Rather cold in here...
This isn't even funny in an ironic sense.
|
|
-
-
fourchan


- Joined on 12-21-2006
- Posts 46
|
Re: Rather cold in here...
Aaron: This isn't even funny in an ironic sense.
Maybe it's funny in that it's not funny at all.
|
|
-
-
fyjham


- Joined on 05-01-2008
- Posts 54
|
Re: Rather cold in here...
BlueKnot:Um... yeah... well, if you're counting on that to overheat your chips to defrost your frostbitten appendages, you'd better be running on some very cheap equipment with no heat sink, because that will overflow and throw an out of range exception fairly quickly I think.
You'll find .NET has a liberal definition of overflowing. Here's the result of multiplying -100 by 1000 constantly: -100000 -100000000 -1215752192 -276447232 -1569325056 -1661992960 159383552 469762048 1610612736 0 After there it gets predictable :P I'm sure if you were to look at the binary you'd be able to find out why that overflow happened, but yeah there's no error for breaking the integer barrier in .NET, just nonsense output. EDIT: Figured I'd give you the code just to make it obvious what I did, as primitive as it is. int i = -100; while (true) { i *= 1000; Console.WriteLine(i); Console.ReadKey(); // So that I can kill it once I get my proof }
|
|
-
-
Ilya Ehrenburg


- Joined on 10-22-2008
- Ashkenas
- Posts 86
|
Re: Rather cold in here...
Not that it really matters, but it's Java.
And morbiuswilters is right.
|
|
-
-
bjolling


- Joined on 06-08-2008
- Belgium
- Posts 157
|
Re: Rather cold in here...
Vechni:
public Heater()
{
int i = 1;
while (true)
{
i = i * 2 - 50;
}
}
Wouldn't the compiler optimize this part away? I don't know Java well enough but in C++ pieces of code that have no effect don't end up in the release version unless (in this particular case) you declare int i as volatile... ...and what Morbs said
Our chief weapon is suprise. Fear and surprise!
|
|
-
-
ZPedro


- Joined on 06-24-2008
- Posts 6
|
Re: Rather cold in here...
You know, in defense of the OP, sometimes when I look at some PSU capabilities, and some video cards consumption, I think I'm looking the specs for an electric heater and not computing equipment. public class Heater { public static void main(String[ args) { new Heater(); }
public Heater() { int i = 1; while (true) { i = i * 2 - 50; } } }
Pah! Real programmers would put enough instruction-level parallelism to saturate the execution units of the processor, including putting floating-point, integer, and vector calculations. They would also spawn enough threads to occupy all cores of the machine (granted, that can be done by spawning multiple copies of the program above). Real elite programmers would also code a version in CUDA (or whatever GPU general-purpose programming language that matches the GPU they have) to also take advantage of the heat generation capabilities of their video hardware.
|
|
-
-
Zemm


- Joined on 11-26-2007
- Gold Coast, Australia
- Posts 125
|
Re: Rather cold in here...
ZPedro:You know, in defense of the OP, sometimes when I look at some PSU capabilities, and some video cards consumption, I think I'm looking the specs for an electric heater and not computing equipment. I am yet to find a 2400W PSU: my portable heater is 2400W. But then we are going into summer now! The beach was great today.
|
|
-
-
belgariontheking


- Joined on 08-20-2007
- Cincinnati, OH, USA
- Posts 1,458
|
Re: Rather cold in here...
ZPedro:Real elite programmers would also code a version in CUDA (or whatever GPU general-purpose programming language that matches the GPU they have) to also take advantage of the heat generation capabilities of their video hardware.
Yeah, but most of them are dangerously insane too.
SpectateSwamp: I can see you. You don't have to hide anymore. C'mon out and play!
|
|
-
-
Thalagyrt


- Joined on 03-16-2006
- Posts 54
|
Re: Rather cold in here...
My gaming rig with its three GTX 280s makes a wonderful space heater. That part of my home is about 5-10 degrees warmer than anywhere else. It's also near to a plasma TV which puts out a good deal of heat as well... Playing Far Cry 2 for example brings the GPUs up to about 85° C, and that just gets pumped right out the back. I need to go pick up some water blocks for those cards... My CPU runs at a cool 35° C at full load thanks to that.
|
|
-
-
Vechni


- Joined on 09-12-2007
- Baltimore, MD
- Posts 124
|
Re: Rather cold in here...
BlueKnot:Um... yeah... well, if you're counting on that
to overheat your chips to defrost your frostbitten appendages, you'd
better be running on some very cheap equipment with no heat sink,
because that will overflow and throw an out of range exception fairly
quickly I think.
And yeah... what morbius said. I would prefer a heatsink....as It would pull heat off of the CPU and disperse it into the air, as opposed to letting disapate from the CPU and onto my desk. And ofc, other reasons. It works pretty well, CPU hits 50%, derrr it's running on 1 core... So, run another instance and it's 100% (you could say that it has a high and low setting).... I have a laptop so I just turn it so that the exhaust fan points to myself and It is rather comfortable..... What did morbs say...? Was his post deleted or something because I don't see it.......
|
|
-
-
morbiuswilters


- Joined on 01-15-2008
- East Coast Represent!
- Posts 3,146
|
Re: Rather cold in here...
Vechni:What did morbs say...? Was his post deleted or something because I don't see it.......
Yes. I told the OP that he was TRWTF. Some stupid hippie moderator deleted it because it didn't contribute to the Love-In or whatever.
< pstorer> Bans don't mean shit on the forum. It's like being on the Sex Offender List. You can still entice kids into your van with candy.
Want more? Go the IRC channel #TDWTFMafia on irc.slashnet.org.
|
|
-
-
Vechni


- Joined on 09-12-2007
- Baltimore, MD
- Posts 124
|
Re: Rather cold in here...
morbiuswilters: Vechni:What did morbs say...? Was his post deleted or something because I don't see it.......
Yes. I told the OP that he was TRWTF. Some stupid hippie moderator deleted it because it didn't contribute to the Love-In or whatever. I don't see the logic in deleting that.
1) I can't refute his opinion if it is deleted, nor read it for that matter but others can...? If he has an opinion it should be open to discussion for everyone.
2) I don't care it's just a forum....? Can you repost...? hopefully the mod won't delete it this time............. This wasn't the case a year ago
|
|
-
-
nion


- Joined on 10-13-2008
- Glen Burnie, MD
- Posts 16
|
Re: Rather cold in here...
I play music. http://myspace.com/abreakinchaos
|
|
-
-
Renan "C#" Sousa


- Joined on 08-10-2007
- Fortaleza, Brazil
- Posts 238
|
Re: Rather cold in here...
fyjham: BlueKnot:Um... yeah... well, if you're counting on that to overheat your chips to defrost your frostbitten appendages, you'd better be running on some very cheap equipment with no heat sink, because that will overflow and throw an out of range exception fairly quickly I think.
You'll find .NET has a liberal definition of overflowing. Here's the result of multiplying -100 by 1000 constantly: -100000 -100000000 -1215752192 -276447232 -1569325056 -1661992960 159383552 469762048 1610612736 0 After there it gets predictable :P I'm sure if you were to look at the binary you'd be able to find out why that overflow happened, but yeah there's no error for breaking the integer barrier in .NET, just nonsense output. EDIT: Figured I'd give you the code just to make it obvious what I did, as primitive as it is. int i = -100; while (true) { i *= 1000; Console.WriteLine(i); Console.ReadKey(); // So that I can kill it once I get my proof }
Just use (checked) before the operation that might overflow. As in
int i = 0;
(checked)i++;
This way it'll raise an exception if it overflows. Yeah I was impressed by how .NET allows overflows to happen without a warning, but I think it's just a minor WTF as there's documentation covering that.
nion:
Indeed.
snoofle That hideousness is what keeps you and I employed!
|
|
-
-
blkballoon925


- Joined on 07-14-2008
- Posts 10
|
Re: Rather cold in here...
It's obvious TRWTF is that "String [args" needs a closing bracket.
|
|
-
-
Wolftaur


- Joined on 10-27-2008
- Posts 99
|
Re: Rather cold in here...
Vechni:I run this code once a day because it's a tad chilly in my cubicle. Don't really plan on spending the money on a space heater. Recently moved north and haven't bought much winter clothes yet.
Amateur!
# cat spaceheater.sh
#!/bin/bash
cd /usr/src/linux
while true; do make -j32 bzImage; make clean; done
Also a handy memory tester, and a handy way to make a RAID5 array sound like a damaged Klingon battle cruiser.
When sucking up to IT gets even dumber than usual: <DriveThruGuy> Welcome to Wendy's. May I take your order? <MyStupidBoss> I can haz cheezburger?
|
|
-
-
cklam


- Joined on 01-10-2007
- Posts 112
|
Re: Rather cold in here...
Vechni:So, I'll show this simple code I use, but if someone else were to find it, they would definetly see a WTF.... public class Heater { public static void main(String[ args) { new Heater(); }
public Heater() { int i = 1; while (true) { i = i * 2 - 50; } } } I run this code once a day because it's a tad chilly in my cubicle. Don't really plan on spending the money on a space heater. Recently moved north and haven't bought much winter clothes yet. Eat more beans.
|
|
-
-
Wolftaur


- Joined on 10-27-2008
- Posts 99
|
Re: Rather cold in here...
cklam:
Don't forget to give him a lighter. No sense wasting perfectly flammable methane.
When sucking up to IT gets even dumber than usual: <DriveThruGuy> Welcome to Wendy's. May I take your order? <MyStupidBoss> I can haz cheezburger?
|
|
-
-
dtech


- Joined on 11-13-2007
- Utrecht, Netherlands
- Posts 424
|
Re: Rather cold in here...
Renan "C#" Sousa:Yeah I was impressed by how .NET allows overflows to happen without a warning, but I think it's just a minor WTF as there's documentation covering that. Java does it too, unlike morbius said. Does anyone know mainstream stong-typed languages that don't allow it? (genuine question) > Executing: C:\Program Files (x86)\ConTEXT\ConExec.exe "C:\Program Files\Java\jdk1.6.0_07\bin\java.exe" OverflowTest
0 1
1 10000
2 100000000
3 -727379968
4 1874919424
5 1661992960
6 -1593835520
7 268435456
8 0
9 0
> Execution finished. class OverflowTest
{
public static void main(String[ args)
{
int a = 1;
for(int i=0; i < 10;i++)
{
System.out.println(i + "\t " + a);
a *= 10000;
}
}
}
|
|
-
-
Spectre


- Joined on 05-09-2007
- Posts 495
|
Re: Rather cold in here...
dtech:
Java does it too, unlike morbius said. Does anyone know mainstream
stong-typed languages that don't allow it? (genuine question)
VB has checking on by default. (genuine answer)
Public Module Test
Sub Main()
Dim i as Integer = 1
Do
i *= 10000
Loop
End Sub
End Module
╩юфют√ь ёЄЁрэшЎрь яюЁр эр яхэёш■.
Visit #TDWTF @ SlashNET - the semi-official WTF IRC channel.
|
|
-
-
Lamah


- Joined on 11-20-2005
- Posts 5
|
Re: Rather cold in here...
Delphi has range and overflow checking modes for the program, but I don't think that they're on by default (they're certainly on in all of my projects!)
|
|
-
-
Fred Foobar


- Joined on 01-29-2006
- Posts 79
|
Re: Rather cold in here...
In before lock.
The TDWTF Drinking Algorithmwhile (numDrinks < 3) { haveADrink(); } gotoWork(); while (numDrinks < 6) { haveADrink(); } wasteMyTimeAndOthersOnTDWTF();
|
|
Page 1 of 1 (24 items)
|
|
|