In the spirit of the Orphanage...
Thinking about boolean logic, specifically true or false.
As a programmer I think of it as one bit but it can also be a non-zero number or zero
which implies any non-zero number is true. Then I thought about infinity, which makes
true outweigh false by infinity-1. Ridiculous.
Then I thought about the internet and gave up.
Maybe we should start thinking of it as "false" (which is always zero) and "not false"?
Of course, strictly speaking "NOT FALSE" would be 1s as far as the eye can see ...
Quote from: NoCforMe on April 04, 2025, 03:32:17 PMMaybe we should start thinking of it as "false" (which is always zero) and "not false"?
Of course, strictly speaking "NOT FALSE" would be 1s as far as the eye can see ...
It's all semantics anyway, about opposites
true or false
black or white
on or off
apple or samsung
them and us
I can barely acknowledge zero as a real number (I can have 0 of something) but minus numbers?
How can I have -2 of something? Nah, negative numbers are irrational.
So I have almost infinity of 0 things, which means that what I do have is either very precious or very trivial.
My mindset and upbringing makes me think precious.
Quote from: sinsi on April 04, 2025, 04:16:13 PMI can barely acknowledge zero as a real number (I can have 0 of something) but minus numbers?
How can I have -2 of something? Nah, negative numbers are irrational.
Just be glad we're not using processors based on 1s complement instead of 2s, with both positive and negative zero ...
That would definitely make my head hurt.
In GfaBasic, you had someflag! boolean variables, which could be zero or -1. You could use them e.g. as
Print Left$("You see the string?", someflag!)
So if someflag! was true, you would see the whole string, if it was false, you saw nothing. I used that quite a bit and was a bit p*ssed off when I found out that C & friends used 0 and +1 as boolean values.
Boolean data type (https://en.wikipedia.org/wiki/Boolean_data_type)
Bool In C Programming | A Comprehensive Guide (+Detailed Examples) (https://unstop.com/blog/bool-in-c)
IMHO -1 as "true" makes much more sense.
include \masm32\MasmBasic\MasmBasic.inc
flag1 BOOL 1
flag2 BOOL -1
somevar dd 12345
Init
deb 4, "Flags in Masm", flag1, flag2
mov eax, somevar
and eax, flag2
mov ecx, somevar
and ecx, flag1
deb 4, "somevar and flags", eax, ecx
EndOfCode
Flags in Masm
flag1 1
flag2 -1
somevar and flags
eax 12345
ecx 1
I just call them 1 and 0. :tongue:
The label or name given them matters not, as long as there is consistency. :biggrin:
Jochen
In basic you could use alternative to if inkey=left then x=x-1
X=x+(inkey=right)-(inkey=left)
Y=y+(inkey+down)-(inkey=up)
Depending on basic version,it produced 1 and 0,other basics it produced -1 and 0
Good to take a look on the above when making simd packed compares
Older c version running on 16 bit system ,standard int= 16 bit ,later standard int 32 bit on 32 bit system
So non bit fiddling fast boolean can use bytesize,wordsize,dwordsize... Depending on system it runs on
Quote from: jj2007 on April 04, 2025, 09:07:27 PMIMHO -1 as "true" makes much more sense.
include \masm32\MasmBasic\MasmBasic.inc
flag1 BOOL 1
flag2 BOOL -1
somevar dd 12345
Init
deb 4, "Flags in Masm", flag1, flag2
mov eax, somevar
and eax, flag2
mov ecx, somevar
and ecx, flag1
deb 4, "somevar and flags", eax, ecx
EndOfCode
Flags in Masm
flag1 1
flag2 -1
somevar and flags
eax 12345
ecx 1
But that's only because you're using it (TRUE) as a bitwise operator.
I don't believe that was ever the intended usage of TRUE and FALSE.
Works out well in your case here, and could still be used for simple "yes/no" detection.
In other words, we could all live with it; it could be considered another variant of "
zero = FALSE, anything non-zero = TRUE".
Str Db "pigs can fly!",0
Terminating zero = false
All ascii codes in characters in the above string = nonzero = true,despite it contains a lie :badgrin:
Quote from: daydreamer on April 08, 2025, 03:21:30 AMStr Db "pigs can fly!",0
Terminating zero = false
All ascii codes in characters in the above string = nonzero = true,despite it contains a lie :badgrin:
Please explain your rambling to us.
What you wrote makes no sense to me.
Obviously, in your example "Terminating zero" should equal TRUE, not FALSE.
Quote from: NoCforMe on April 08, 2025, 05:56:31 AMPlease explain your rambling to us.
What you wrote makes no sense to me.
Bbbut...
It
is topic related, in any case: "
Ramblings..." :skrewy: :joking:
Quote from: zedd151 on April 08, 2025, 05:58:48 AMQuote from: NoCforMe on April 08, 2025, 05:56:31 AMPlease explain your rambling to us.
What you wrote makes no sense to me.
Bbbut...
It is topic related, in any case: "Ramblings..." :skrewy: :joking:
:joking: :badgrin:
does that mean always when being accused of post ramblings anywhere in forum,Stoo needs to move the rambling posts here ?:)
Quote from: daydreamer on April 09, 2025, 02:25:36 AMdoes that mean always when being accused of post ramblings anywhere in forum,Stoo needs to move the rambling posts here ?:)
I really don't think he would want to go through all that trouble. There is a lot of 'rambling' going on throughout the forum. :joking: :rofl:
Such is life. :tongue:
I like how sinsi put this topic back on the rails after this post. :tongue: :toothy: :joking:
In VB you could have code like this
If FunctionThatReturnsAnInteger(arg) then
DoSomethingWhenTrue
Else
DoAnotherThingWhenFalse
End If
The missing code is implied If FunctionThatReturnsAnInteger(arg) <> 0
False = 0
True = non-zero
But we also have to take into account the size of what we're testing. For example, RegisterClassEx returns an ATOM (16-bit unsigned) but how many of use this code to check for success?
test eax,eax ;should be test ax,ax ?
jz failed
How does C/C++ test for failure with this function?
Quote from: daydreamer on April 09, 2025, 02:25:36 AMdoes that mean always when being accused of post ramblings anywhere in forum,Stoo needs to move the rambling posts here ?:)
Get off my lawn!
Quote from: sinsi on April 09, 2025, 02:49:18 AMQuote from: daydreamer on April 09, 2025, 02:25:36 AMdoes that mean always when being accused of post ramblings anywhere in forum,Stoo needs to move the rambling posts here ?:)
Get off my lawn!
reminds me off old dos game "Red Neck Rampage" enemies walks around -"get off my lawn!" :)
Quote from: daydreamer on April 09, 2025, 03:05:06 AMreminds me off old dos game "Red Neck Rampage" enemies walks around -"get off my lawn!" :)
Ah yes, the cheerleaders in the school bus complaining how "nipply" the weather was :biggrin:
Create a traditional Windows Desktop application (C++) Benny Hill (https://learn.microsoft.com/en-sg/answers/questions/1650648/create-a-traditional-windows-desktop-application-)
Quote from: TimoVJL on April 09, 2025, 03:28:31 AMhttps://learn.microsoft.com/en-sg/answers/questions/1650648/create-a-traditional-windows-desktop-application- (https://learn.microsoft.com/en-sg/answers/questions/1650648/create-a-traditional-windows-desktop-application-)
OK, let me rephrase my question.
How does the disassembly of C/C++ code show the test for failure with this function?
test ax, ax
00000071 8D45D0 lea eax, [ebp-30h]
00000074 50 push eax
00000075 FF1500000000 call dword ptr [__imp__RegisterClassExA@4]
0000007B 6685C0 test ax, ax
0000007E 7507 jnz L_87
00000080 31C0 xor eax, eax
00000082 E98B000000 jmp L_112
000000AF 488D8C2490000000 lea rcx, [rsp+90h]
000000B7 FF1500000000 call qword ptr [__imp_RegisterClassExA]
000000BD 6685C0 test ax, ax
000000C0 7507 jnz L_C9
000000C2 31C0 xor eax, eax
000000C4 E9C8000000 jmp L_191
Excellent TimoVJL, cheers :thumbsup:
Fun fact, you can use the returned atom in CreateWindowEx
QuotelpClassName If a class atom created by a previous call to RegisterClass or RegisterClassEx, it must be converted using the macro MAKEINTATOM. (The atom must be in the low-order word of lpClassName; the high-order word must be zero.)
Quote from: sinsi on April 09, 2025, 04:24:30 AMFun fact, you can use the returned atom in CreateWindowEx
Oh no....! Once more we need to rewrite our templates ;-)
invoke CreateWindowEx, WS_EX_ACCEPTFILES, rv(RegisterClassEx, addr wc), chr$("Hello World"),
WS_OVERLAPPEDWINDOW or WS_VISIBLE,
600, 150, 750, 400, ; window position: x, y, width, height
NULL, NULL, wc.hInstance, NULL
Quote from: sinsi on April 09, 2025, 02:48:09 AMIn VB you could have code like this
If FunctionThatReturnsAnInteger(arg) then
DoSomethingWhenTrue
Else
DoAnotherThingWhenFalse
End If
The missing code is implied If FunctionThatReturnsAnInteger(arg) <> 0
False = 0
True = non-zero
But we also have to take into account the size of what we're testing. For example, RegisterClassEx returns an ATOM (16-bit unsigned) but how many of use this code to check for success?
test eax,eax ;should be test ax,ax ?
jz failed
How does C/C++ test for failure with this function?
Butbutbut ... even if we do get an ATOM returned (unsigned WORD), it's still going to be non-zero if successful (
test eax, eax will evaluate to non-zero), so what's the problem?
After all,
AX is half of
EAX.
Theoretically, RegisterClassEx could return BAAD0000h...
About atoms in Windows
Atom=atom+atom ; fusion
Atom=atom/2 ; fission :tongue:
CS_BYTEALIGNCLIENT
0x1000
Aligns the window's client area on a byte boundary (in the x direction).
This style affects the width of the window and its horizontal placement on the display.
CS_BYTEALIGNWINDOW
0x2000
Aligns the window on a byte boundary (in the x direction).
This style affects the width of the window and its horizontal placement on the display.
I see those class flags still used today :badgrin:
Quotepprntly fr n nglsh spkr ths s stll rdbl, vn wth n vwls.
Hw d thr lnggs fr? Ds lngg tht ss ccnt mrks wth thr vwls fr s wll?
Apparently for an english speaker this is still readable, even with no vowels.
How do other languages fare? Does a language that uses accent marks with their vowels fare as well?
Quote from: sinsi on May 13, 2025, 01:47:54 PMQuotepprntly fr n nglsh spkr ths s stll rdbl, vn wth n vwls.
Hw d thr lnggs fr? Ds lngg tht ss ccnt mrks wth thr vwls fr s wll?
Apparently for an english speaker this is still readable, even with no vowels.
How do other languages fare? Does a language that uses accent marks with their vowels fare as well?
Do you mean arabic? Different accent mark above changes what kind of vowels
Japanese hiragana /katakana and swedish extra characters 27, 28,29? Which have in common usage of two dots and a ring over (swedish) or upper right corner(hiragana /katakana) a character
In swedish changes vowels A and O sounds
Swedes are used to read them without accent marks,because all kinds of TV broadcasting sport and music from outside sweden, display showing info are mostly capable of a-z characters
Hiragana /katakana instead can change k's to g's in for example "Anata segoi"
It's fascinating that many complete different languages from Europe, Middle East and Asia, they came up with similar language script system
Quote from: sinsi on May 13, 2025, 01:47:54 PMApparently for an english speaker this is still readable, even with no vowels.
How do other languages fare? Does a language that uses accent marks with their vowels fare as well?
I wanted to know if a non-english language would cope without vowels.
One that uses the ABC alphabet, not kanji/arabic 'script', so for example á Á à À ȧ
To me they are one vowel, but how does removing them from a language affect the
reading comprehension?
That's why I'm not using an online translator, I would prefer a Swedish native would translate the quote into Swedish, remove the vowels, then see if the remainder makes sense in Swedish.
(substitute your native language and let me know.)
Part-reason: wondering whether it's worth the time to switch to unicode (well, Microsoft's version for now).
Drowning in the 8/16/32/multi bit world...
Sinsi
"á Á à À",sometimes used in names, to change pronounce from the usual vowel to the one with accent mark
A database with lots of names, many users with names like -"svensso'n" would be angry they got their name spelled wrong that their name isn't same as "svensson" and might be spoken wrong by some personal that use database, forget the special importance of second vowel
Quote from: sinsi on May 13, 2025, 01:47:54 PMQuotepprntly fr n nglsh spkr ths s stll rdbl, vn wth n vwls.
Hw d thr lnggs fr? Ds lngg tht ss ccnt mrks wth thr vwls fr s wll?
Apparently for an english speaker this is still readable, even with no vowels.
How do other languages fare? Does a language that uses accent marks with their vowels fare as well?
Try this:
QuoteAnapretply fro an elingsh skerpea tsih is slitl dreablae, veen thwi no wovles.
Woh do thoer alagunges arfe? Esdo a glaungea hatt sues cantce krams thiw reith wolves rafe sa lewl?
Bet you could still read that without too much difficulty (fidiclufty), yes?
Quote from: NoCforMe on May 14, 2025, 05:43:08 AMQuoteEsdo a glaungea hatt sues cantce krams thiw reith wolves rafe sa lewl?
That bit was gibberish to me.
Quote from: sinsi on May 14, 2025, 07:15:22 AMQuote from: NoCforMe on May 14, 2025, 05:43:08 AMQuoteEsdo a glaungea hatt sues cantce krams thiw reith wolves rafe sa lewl?
That bit was gibberish to me.
"Does a language that uses accent marks with their vowels fare as well?"
Took me a minute to get into an anagram mindset.
Would have been better if each word had an anagram which is also a valid word. i.e., wolves for vowels, etc. :biggrin:
Well, the point I was trying to make is that the brain can apparently recognize words even if the letters are out of order.
I may have mixed them up a little bit too much in some cases. But you can try this yourself, and it's surprising how easily you can read mixed-up text. This tells us something about how our cognitive processes work.
Tom riddle = voldemort
You can even use" 1337"
Reminds me of old trick turn calculator upside down so some digits looks like characters,3= e,7=l
For example "shell"
Can we have forum statistics on how many code uploads and sizes/ number of uploads ?
After that publish the best coders by # of uploaded code and quality by sizes/number of uploads = lowest
Exceptions are really big packages like masmbasic ,uasm
???
Why
Because have no idea,how many uploaded codes I made over all many years this forum existed ,I am curious and want to know how many I uploaded and how small size/ number of uploads = low number quality, very high number = infamous bloat
And curious how other members contributed over the years
Lot of source files was removed after 2022-02-24 with good reason.