- 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
Old Coder>I am wielding my +1 programming language from hell.
Newer Coder> I counter by implicitly casting a C++ spell
Admin
My point was more about the language not having that decimal-point representation.
For example, in some more modern cutting-edge languages I have a 'currency/money' or even just 'decimal' type, into which I can store 123.45 and it stays like that. I don't care how it's handled internally, I just want it to be 123.45 and play happily with all the other numbers.
Admin
Admin
Admin
I don't see the problem -- that's how Oracle works today.
Admin
Admin
Admin
In addition to T and F, I propose W.
Then we can have W for true, T for false, and F for file not found.
Admin
The set of True values (T, Y, 1, N) The set of False values (F, N, 0) The intersection of True and False values (N)
So far, none of the suggested solutions will handle the value N being used vor both True and False.
Admin
I don't see the problem here. Are you aware that a boolean takes just as much space as a character? Having boolean datatypes is stupid, especially when the need for a "maybe" comes up and you have to go retrofit your code. Now, having boolean logic is another story.
Admin
Admin
Admin
I was once moved into a position where I had to work with an AS/400 - nothing newer than RPG3 - 6 character variables max, all caps, "Databases" were files, and use of the newfangled SQL was forbidden. Green Screen was holy, and I hightailed it out of there faster than you could mouth WTF!
Admin
What's a SOC4?
Admin
Similar strategies will work for the true/false problem. FLAG='N'; FALSE='T' means that FLAG is to be evaluated on the T/N spectrum, with T meaning false so obviously N is true! Or at least Not False.
Admin
Admin
I don't know, but there was once a circuit called the spaghetti logic parallel processor (SLOPP).
http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=140738&tag=1.
Admin
Excuse me? CICS does not equal Unix! I know that for a fact. I used to work as an operator on a mainframe IBM system for a large metro bank.
We had CICS - "Customer Information Control System" running on a flavor of IBM OS (pre MVS). The tellers would call a phone number that was answered by the mainframe. They would punch in a query, and the system would read back the results using a series of looping tapes, each one with a word or word part.
If you look CICS up now, you find that it runs on z/OS, which I imagine is where the confusion comes in, but CICS is NOT UNIX, nor an Operating System!
Admin
Comprehension fail.
Admin
When I was in high school, I took a night class in COBOL for fun.
Admin
So the empty string represents Not a Boolean then. Makes sense.
Admin
If that were me, I would resist the compelling urge to slit my wrist and instead slit everyone else's.
Admin
Run Forest, Run!
Admin
We all did stupid things in high school...some of us don't turn around and brag about them. /s
:D
Admin
TRWTF in the article is that so many different string representations were used to represent boolean values.
TRWTFs in your comment are (1) boolean datatypes don't HAVE to take as much space as a character -- see c, for example; (2) even in those languages in which a boolean datatype does take up a full byte, boolean comparisons will take up less time than character comparisons; and (3) failing even THAT, using strings to represent boolean values leads you right into the article's TRWTF.
Of course, TRWTF with my comment is that odds are you're a troll.
Admin
Admin
Admin
In C, there is no boolean data type. That's why everyone uses int.
Admin
When I was in high school, I banged chicks for fun.
Admin
I googled for an example of a language which uses a bit boolean, and c came up in an IBM MAC OS X c/c++ compiler guide. So I may be wrong in my specific example, or I may be right but only for a highly specific flavor of c. I haven't actually touched c since college, so please forgive me for this.
The points still stand.
Admin
Admin
jpers' comment made me wonder if I could come up with a way to store booleans in less than a byte without making a really wtf-rific mess of it. The only thing I can think of would be to collect all of the booleans in a given program and store them in a "boolean pool" which would be as many bytes as needed, which would allow you to address them by grabbing that byte (or two bytes, or whatever your machine grabs) and looking for the correct bit. So your first boolean would require as much space as before, but your next seven would fit in the same byte as the first. Sounds like a bit of a nuisance to me. Sorry, no, a lot of a nuisance.
But of course we're all aware that booleans aren't used to save space, they're used to constrain the possible values a boolean variable can take. That is, they exist to clarify the code, not to minimize the memory used.
Admin
[quote user="trwtfjpers' comment made me wonder if I could come up with a way to store booleans in less than a byte without making a really wtf-rific mess of it.[/quote] Easy peasy. Just use an 8051 and put them in the bit-addressable space.
Admin
According to MSDN, SQL Server 2008 does it this way.
http://msdn.microsoft.com/en-us/library/ms177603.aspx
Admin
Admin
I came across something like this once too. It was because they used a string column in a database instead of a boolean one (which existed). And they too were not consistent so I had to check for "JA" (Dutch Yes), "J", "Y" and "YES".
Admin
VSAM is mainly used to retrieve records given one or more keys. A type of indexed-sequential file access. Datasets (IBMese for "file") are limited in size to 128 terabytes.
An 0C4 is a memory access error -- if a program tries to execute outside of the memory assigned to it.
CICS is a TP (transaction processor) monitor -- think (using a loose analogy) of a web server. What runs under CICS is application programs (think most of the banking in the world, for example).
That answer preceding questions?
Admin
Yeah, but then how much code would you need to manage that pool? That's TRWTF!
captcha: "tego" - Polish word for "that".
Admin
Gotta correct everyone.
CICS and VSAM DOESN'T run on the AS/400 (iSeries, System i5, System i, whatever IBM is calling it these days.)
It has it's own operating system and database. So if he was running into CICS and VSAM, it's a Z/OS mainframe.
And the AS/400 when it was first released was called a mini-computer. Don't ask why the distinction.
Admin
I wonder if the insane asylum needs any programmers
Admin
(It didn't seem right to betray his trust.)
Admin
Aaaand fail -- as soon as you told us you were doing it, it wasn't implicit any more!
Admin
I guess in Smalltalk, you would just create new sub classes of False and True. If you are ever stuck with N/F, Y/N where sometimes N means true and sometimes N means false, just send/throw subclassResponsibility FNF and let the on-call support person figure it out.
Admin
Also AS/400, with POS in RPG. And no, it't not Point Of Sale...
Admin
It is impossible to store a boolean in anything less than a byte because COMPUTERS are incapable of addressing a smaller portion of memory than that. Point destroyed.
Why would boolean comparisons take any longer than character comparisons? Either one is an AND instruction at the machine level and a check if a register is set afterwards. Point destroyed.
I am not talking about strings, I am talking about CHARACTERS. In case you haven't noticed, there's a difference between the two in all languages. Having a) the flexibility to introduce new values, and b) the specificity of using "Y/N" vs. "T/F" vs. "1/0" vs. "M/F" when appropriate is an enormous advantage.
How could you manage to get all three points wrong? I'm guessing it's you who's the troll.
Admin
In perl there are no boolean data types. You can however, TEST for boolean values. All values other than "" or "0" are true (strings, int, float, etc (although perl doesn't have these data types either)).
Conversely the only false values are "" or "0".
so in perl "N", "Y", "FnF", "1", "ReallyFalse", "ExtraFalse", "Maybe" all test true.
Any way, that's my $.02.
Admin
One thing I've learned from this site and other similar stories: In a job description filled with buzzword technologies that sound good but slightly vague, when you see an acronym you don't recognize hiding somewhere inconspicuously, run.
It's a decade-old technology and the only thing they actually want you to work on after they have lured you in by mentioning modern languages you actually like and are familiar with.
Admin
Listed in the job description as: "cutting-edge genetic algorithms".
Admin
Admin
Nice.