- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Probably they had a nasty encounter with the tax man.
I vote ***** for this wtf.
Admin
... which made it return File_Not_Found.
;-)scnr
Admin
Problems like this still exist. I'm currently using C to program an ATmega microcontroller with a proud 1kb of RAM, and 8kb of seperate program memory. It's very easy to smash the stack right into the heap, especially when you are inexperienced enough to use normal string literals - these are copied into RAM before they are used, so you can get a normal pointer to an adress in RAM space.
To prevent this, you have to define the strings to be in program memory (there is a handy macro for this), giving you pointers which are syntactically just the same as the ones into RAM, so you have to use special functions which interpret these pointers correctly. There is a convention that these functions are suffixed with "_P", an example would be "printf_P(PSTR("Hello World!\n"));". Not too inconvenient, but you have to know it first...
In fact, there might even be a third type of pointer, for access to the eeprom memory, but I didn't work with this yet.
Admin
I can't for the life of me figure out the point of the if statement. Doesn't this do the same thing, with less clock cycles:
vtaxrate = 0.06;
Admin
Admin
What Doubts meant was that the programmer who reported this WTF figured out what was going on, not the clueless person who added tax test.
Actually, volatile is meant for memory mapped hardware registers. Volatile is used to tell compiler not to get excited about code using seemingly non-initialized variable because it really isn't a variable at all but hardware register. Using it to share memory between processes is dangerous -- there are better ways to do that.
Admin
If your compiler can detect potential stack overflows and still allows recursion, then your compiler can detect whether your program has infinite loops -- a problem that has been proven to be unsolvable.
Right. The generated code could check the remaining space on the stack segment (between bottom of stack and top of heap) at the entrance of each function. But there is a high per-function-call performance impact. Segmentation is used in both real mode and 16-bit protected mode (introduced in the 286). Indeed segmentation is still in effect in 32-bit, paged protected mode (introduced in the 386), but with 32-bit addresses, people simply prefer to use a flat memory mode and set all segments registers to map to the same logical addresses (but with different segment descriptors for code/data/stack). This statement is tricky. Indeed, you can only address 64kB with 16-bit pointers. If you want to address beyond that, you need to pick different segment registers. There are 4 segment registers on the 286 (and 186 and 8086/8088). That effectively adds 2 extra "hidden" bits. So, the 286 can access only at most 256kB concurrently. Beyond that, you have to set segment registers to different values. That's very inefficient. Furthermore, you can't do much with the code segment and stack segment, because they have their specific uses. "Hence"? I can't see how the last statement logically follows from what you have said.The fact is that there are only 20 lines on the address bus of a 8086/8088/80186. This is the very reason WHY you can only address 1MB in total. (There is one more line you can exploit: the I/O address bit, which has to be accessed using the IN/OUT instructions, which limits its use.)
More accurately, it's "to wrap around" rather than "to overflow". The choice to make DS==SS is to make ALL data pointers to be near pointers. The original article says that "most variables are global". So, they should be allocated on the data region (I use "region" here instead of "segment" to avoid the confusion with 8086's "64k segments"). Oh! Normally, the data region is allocated below the BSS region, which is below the heap. So, if their program's stack region has grown to a point to have overwritten the data segment, that means all of the heap and BSS regions have been ruined already. That's a pretty severe problem! If you mix near/far pointers in a program and do not handle them with care, it'll easily crash. Me too.Admin
But it's stupid not to change a running system that is BROKEN!
Admin
Nothing prevents packed decimals to be used with other languages such as C, C++, Java, Perl, Python. You can easily write a library to handle packed decimals, much like libraries implementing complex numbers for these languages. (Fortran has built-in support for complex numbers. Has that driven everyone who needs to compute complex numbers to use Fortran and give up C++/Java? Common LISP has not only complex numbers, but also rational numbers. Has this caused people to stop developing ration-number classes in C++/Java and switch to writing programs in LISP?) With some languages (e.g. C++), you can even overload the operators to make using the library more convenient.
The real reason that many banks still keep COBOL-based systems around is: legacy systems.
Admin
Admin
It shouldn't be allowed to reply without reading the previous comments first... Of course you have to avoid a WTF for the first posts :-)
Admin
[quote user="TheM"][quote user="DrYak"]@ Doubts
Actually, volatile is meant for memory mapped hardware registers. Volatile is used to tell compiler not to get excited about code using seemingly non-initialized variable because it really isn't a variable at all but hardware register. [/quote]
And not to optimize it away!
volatile int x=0 ; while (x=0) { whatever ; }
Captcha: craaazy
Admin