• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

what is this notation qs*=

Started by Chris Chancellor, January 14, 2019, 04:37:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chris Chancellor

Hello Charles

i saw the below codes in the O2 forum  at  reply#6
https://www.oxygenbasic.org/forum/index.php?topic=1847.msg20013;topicseen#msg20013


quad qs=0x10000 : qs*=0x10000
quad a= qs*0x12345678+0x9abcdef0


i don't understand the notation qs*=0x10000

i knew 0x10000  is a hex number  but not  qs*

because *  means multiplication for normal operators

what does  qs*   or  qs*=    do ?

are these notations derived from C ?

sorry that i asked these simple questions


Mike Lobanovsky

qs *= 0x10000 is a shorthand for qs = qs * 0x10000 pretty much like qs += 1 is a shorthand for qs = qs + 1.

The math operator preceding assignment can be any arith or logical operator like *=, /=, AND= etc., in which case the expression unrolls as shown above.

Note there should be no space between the operator and assignment for the O2 parser to understand the expression.
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

Chris Chancellor