News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

The multiplicaiton order

Started by Farabi, March 28, 2010, 10:18:51 PM

Previous topic - Next topic

Farabi

I got this piece of code

dibs.dsBmih.biSize+dibs.dsBmih.biClrUsed*sizeof(RGBQUAD)


How should I multiply it?

(dibs.dsBmih.biClrUsed*sizeof(RGBQUAD))+dibs.dsBmih.biSize


Or

(dibs.dsBmih.biSize+dibs.dsBmih.biClrUsed)*sizeof(RGBQUAD)
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

oex

dibs.dsBmih.biClrUsed*sizeof(RGBQUAD)

+

dibs.dsBmih.biSize

Always multiplication first unless brackets
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Astro

Brackets
Exponents
Roots
Division
Multiplication
Addition
Subtraction

If in doubt, bracket it out!  :U  Force your intention.

Best regards,
Robin.

tenkey

The last two are actually

Multiplication and division, left to right
Addition and subtraction, left to right
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

Farabi

Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"