Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a function win_rgb() and remove #define #359

Open
JoseQuintas opened this issue Aug 28, 2024 · 2 comments
Open

Create a function win_rgb() and remove #define #359

JoseQuintas opened this issue Aug 28, 2024 · 2 comments

Comments

@JoseQuintas
Copy link

JoseQuintas commented Aug 28, 2024

On hbwin.ch
#define WIN_RGB( nR, nG, nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) )

This can cause a bug on use

COLOR WIN_RGB(1,1,1)
is translated to
COLOR ( 1 + ( 1 * 256) + ( 1 * 256 * 256 ) )
but compilation uses this as a function, no matter about spaces.

may be better to create a real function.
FUNCTION WIN_RGB( nR, nG, nB )
RETURN ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) )

@diegopego
Copy link

Oi quintas!

eu obtive um resultado diferente. será que tem algo a mais na hbwin que provoca o comportamento que você descreveu ou eu que não compreendi?

abraço!

#define WIN_RGB( nR, nG, nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) )

COLOR WIN_RGB(1,1,1)

hbpp color.prg

COLOR ( 1 + ( 1 * 256 ) + ( 1 * 256 * 256 ) )

@JoseQuintas
Copy link
Author

Isso foi diferença causada pelo editor do github, já editei pra colocar espaços nos asteriscos.
O problema é o compilador usar como função COLOR ( n ) é o mesmo que Color( n ) para o compilador.
Por isso usar o #define acaba atrapalhando.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants