Question about C-Code

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
jacdelad
Addict
Addict
Posts: 2029
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Question about C-Code

Post by jacdelad »

Hi,
I have no knowledge of C, but after the discussion about the volatile variables I got curious and had a look at the code created. I found something that I don't understand:

Code: Select all

// SetGadgetState(progressbar_900,#PB_ProgressBar_Unknown)
integer rr11498=PB_SetGadgetState(v_progressbar_900,-1LL);
The variable "rr11498" (is it a variable?) is never used, except on this line. As far as I understand the result is stored, but not used (I don't use it too). I have found hundreds of lines like this. Isn't that...unnecessary? The same happens with "DisableWindow", though this function never returns anything (=always "0").
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
idle
Always Here
Always Here
Posts: 6025
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Question about C-Code

Post by idle »

yes it's a PBcompilerc generated variable and it will get eliminated by the c compiler as it's unused, it's probably there because it clears up any ambiguity generating the c translation, the compiler will be checking the PB syntax and also evaluating the statements so it generates a variable to satisfy the rules of a binary operand.
User avatar
jacdelad
Addict
Addict
Posts: 2029
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Question about C-Code

Post by jacdelad »

Ah ok. So no unused memory wasted.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
idle
Always Here
Always Here
Posts: 6025
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Question about C-Code

Post by idle »

yes it'll be removed from the assembly.
Post Reply