October 30, 2025, 09:23:14 AM

News:

IWBasic runs in Windows 11!


Operators/Syntax

Started by LarryMc, January 10, 2006, 10:49:18 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

LarryMc

Paul;
I got your source so now I'm really dangerous. ;D

1)Do the following 2 lines mean exactly the same from a syntax standpoint and can the format be used either way?
It would make a difference when converting from 'other' languages.

Quote#define WM_GETFONT 0x31
CONST WM_DRAWITEM = 0x2B;

2)In all of your source I only found one 'if' statement that used "==" to test for 'equal to'.ÂÃ,  All the other 'if' statements used '='.
Are both okay to use?

3. what is the definition of the operator '->'?ÂÃ, 

4. Is there a corresponding '<-' ? (seen in web tutorials but didn't find in your source)

5. What do '>>' and '<<' signify?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

1) yes they are the same.  Use #define for your own use

2) thats a typo.  Where did you find it?

3) That is the pointer derference operator.

*c.blah
c->blah

Are equivelents.  Your used the first from other languages, I am used to the second form and it is more common.

4) Not that I know of.

5) Bit shifting. 
Ionic Wind Support Team

LarryMc

January 10, 2006, 11:01:27 PM #2 Last Edit: January 10, 2006, 11:03:22 PM by tlmccaughn
Quote2) thats a typo.ÂÃ,  Where did you find it?

After double checking it is a comment in mathlib.a line 293.

I was using 'find in file' on the entire set of source files.

Sorry for the false alarm on that one.


On the '->' I'm just going to have to search the internet for some more tutorials to get a handle on that. I had never used pointers at all.

Thanks
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Parker

If it's a comment that you found that operator in, it's because Paul uses C++ a lot, in which case the = operator is always assignment and == is testing. For example,
if( (a=b)==c )
will first assign a to be, and then test for equality to c. The aurora code would look like this:
a = b;
if (a = c)

John S

There seems to be an inconsistancy with the use of the "=" in testing (or at least there is some problem with the FOR Loop).

When I use "=" in a FOR loop test it won't compile, but it will in other tests such as "while bla=bla" and "if bla=bla"


  for (count = 1; count = 5; count++)                      // this doesn't work

  for (count = 1; count <= 5; count++)                     // this works o.k.

  if (text = "quit")||(text = "QUIT") break;                 // this works o.k.

  while (getkey() = "");                                            // this works o.k.


I haven't tried any OOP stuff yet, just stumbling through simple console stuff.
John Siino, Advanced Engineering Services and Software

Parker

The || operator means XOR in Aurora, the word "or" is used for the purpose of C's ||. I've never used the "count=5" syntax in that part of a for loop, it should work, I guess Paul will have to fix that.

John S

thanks for the heads up on the ||, I thought it was "or"
I got my FOR to work using <= and >=.  The = failed to compile.
John Siino, Advanced Engineering Services and Software