piece of javascript code
-
#define FALSE 0 #define TRUE (!FALSE)
**
xacc.ide-0.2.0.75 - now with C# 3.5 support and Navigation Bar!
**
In Visual Basic TRUE is -1... in most languages TRUE is 1. For e.g. if I call a C function in a dll from visual basic and the return value is a boolean you will have problems if you test the result against "true". Best regards, Mauro.
-
In Visual Basic TRUE is -1... in most languages TRUE is 1. For e.g. if I call a C function in a dll from visual basic and the return value is a boolean you will have problems if you test the result against "true". Best regards, Mauro.
Mauro Leggieri wrote:
In Visual Basic TRUE is -1... in most languages TRUE is 1.
Not necessarily. False is normally 0, and True is any non-zero value.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
In Visual Basic TRUE is -1... in most languages TRUE is 1. For e.g. if I call a C function in a dll from visual basic and the return value is a boolean you will have problems if you test the result against "true". Best regards, Mauro.
And by the same token, you must be careful in C when calling VB code to use -1 (VARIANT_TRUE) in boolean parameters. It's easier by far to just avoid VB... or failing that, wrap such ugly interactions in a dedicated facade such that you can continue using the boolean type in your language as it was intended.
----
Yes, but can you blame them for doing so if that's the only legal way they can hire programmers they want at the rate they can afford?
-- Nish on sketchy hiring practices
-
Mauro Leggieri wrote:
In Visual Basic TRUE is -1... in most languages TRUE is 1.
Not necessarily. False is normally 0, and True is any non-zero value.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Yes... but like the first post of this thread, you find lots of code that compare values against true instead of doing it with false where its value does not change across languages. Best regards, Mauro.
-
And by the same token, you must be careful in C when calling VB code to use -1 (VARIANT_TRUE) in boolean parameters. It's easier by far to just avoid VB... or failing that, wrap such ugly interactions in a dedicated facade such that you can continue using the boolean type in your language as it was intended.
----
Yes, but can you blame them for doing so if that's the only legal way they can hire programmers they want at the rate they can afford?
-- Nish on sketchy hiring practices
How about we just shoot all the numpties* that learn VB (that was sarcasm: I am one), just to get into the swing of it, you know, hobbyists? People that aren't getting paid to learn modern-day hieroglyphics for an extra 20% performance in their app, [to cue the sarcasm again] because they are noobs and know not the way of truth, light, and irritating bugs to do with random punctuation mistakes. [Start of ostentatious, verbose humour, with nationally-specific "u"] * To prevent a language war, a "numpty", or pl. "numpties" is Scots slang for someone who is incorrect or inferior on a matter. Note that it is about as offensive as mistaking the gender of someone's budgie. Example: "Ye** should be passing parameters here, not using a global variable, ye numpty." ** "Ye" is a reference to "You". No, not you, "you". [End of humour...or is it?]
Need Another Seven Acronyms...
Confused? You will be... -
How about we just shoot all the numpties* that learn VB (that was sarcasm: I am one), just to get into the swing of it, you know, hobbyists? People that aren't getting paid to learn modern-day hieroglyphics for an extra 20% performance in their app, [to cue the sarcasm again] because they are noobs and know not the way of truth, light, and irritating bugs to do with random punctuation mistakes. [Start of ostentatious, verbose humour, with nationally-specific "u"] * To prevent a language war, a "numpty", or pl. "numpties" is Scots slang for someone who is incorrect or inferior on a matter. Note that it is about as offensive as mistaking the gender of someone's budgie. Example: "Ye** should be passing parameters here, not using a global variable, ye numpty." ** "Ye" is a reference to "You". No, not you, "you". [End of humour...or is it?]
Need Another Seven Acronyms...
Confused? You will be...Wait now, i'm confused - which language was it that decided only one value out of 4 billion+ available was valid as
true
? ;) (but that's the problem with grand abstractions - they tend to leak around the edges...)----
Yes, but can you blame them for doing so if that's the only legal way they can hire programmers they want at the rate they can afford?
-- Nish on sketchy hiring practices
-
Wait now, i'm confused - which language was it that decided only one value out of 4 billion+ available was valid as
true
? ;) (but that's the problem with grand abstractions - they tend to leak around the edges...)----
Yes, but can you blame them for doing so if that's the only legal way they can hire programmers they want at the rate they can afford?
-- Nish on sketchy hiring practices
[Terminal screen display on Ninja] > ping 127.0.0.1:Brain Timeout. Timeout. Timeout. Timeout. Warning! Critical system component failure detected. OK to continue living, (Y)es or (N)o? * Please note: Computers do not understand sarcasm * > ... In otherwords, huh? Oh, you're insulting VB? Ach, shameful. I'm not fussed about defending VB, so long as someone realises it is at least easy to learn, using less than all of the keys on the keyboard. I'm just here for the humour; he says, getting serious and rolling up his sleeves...;P
Need Another Seven Acronyms...
Confused? You will be... -
Actually...the laughing smiley is :laugh:. ;)
Somewhere I have seen a laugh-and-roll animated smiley. I was actually intending to mention that.:)
Vasudevan Deepak Kumar Personal Homepage Tech Gossips
-
Wait now, i'm confused - which language was it that decided only one value out of 4 billion+ available was valid as
true
? ;) (but that's the problem with grand abstractions - they tend to leak around the edges...)----
Yes, but can you blame them for doing so if that's the only legal way they can hire programmers they want at the rate they can afford?
-- Nish on sketchy hiring practices
-
All of the ones that aren't equal to false... ;)
----
Yes, but can you blame them for doing so if that's the only legal way they can hire programmers they want at the rate they can afford?
-- Nish on sketchy hiring practices
-
Let me nominate the value 47 as true. Why? Because I've always liked that value. So lets pustulate a language where zero and 47 are both true.
2b|!2b==? wrote:
Let me nominate the value 47 as true.
47, being not equal to 'false', is 'true'. What is your problem with that concept?
2b|!2b==? wrote:
So lets pustulate a language where zero and 47 are both true.
Stop, 0 is defined to being 'false'. You might use the Humpty-Dumpty-boolean-logic, but please lets not confuse others. *) Humpty appears in Lewis Carroll's 'Through the Looking-Glass', where he discusses semantics and pragmatics with Alice. "When I use a word," Humpty Dumpty said, in rather a scornful tone, "it means just what I choose it to mean -- neither more nor less." Among other things, he (mis-)explains the difficult words from Jabberwocky.
Failure is not an option - it's built right in.
-
I found a piece of javascript code when i did a code review. I am just sharing with you
function getState(radioButton) { if(radioButton.checked == true) return true else return false }
Regards, Sylvester G sylvester_g_m@yahoo.com
Tee-hee-hee. Hey, it's Javascript. You weren't expecting software engineering, were you?
-
In Visual Basic TRUE is -1... in most languages TRUE is 1. For e.g. if I call a C function in a dll from visual basic and the return value is a boolean you will have problems if you test the result against "true". Best regards, Mauro.
-
I found a piece of javascript code when i did a code review. I am just sharing with you
function getState(radioButton) { if(radioButton.checked == true) return true else return false }
Regards, Sylvester G sylvester_g_m@yahoo.com
:laugh::laugh:
Regards, Satips.:rose: Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead; Walk beside me, and just be my friend. - Albert Camus