Is small like C++
I recentley learned C++, and I am looking at some of Gir's old plugins. It seems that, Small is a rip-off, of C++.
|
Re: Is small like C++
Quote:
you can t compile to execute in standalone version ! not a rip off tssss Basic is a rip of LOGO ( lol ) |
Almost all languages these days follow a C style syntax, noted by Allman-style block coding, semicolons for line termination, and cell/array based data types (C-Style strings).
Small was originally called "SmallC", it's meant to be a tiny, compact version of C which can run on an embedded machine. While certainly not the best of scripting languages or machines, it IS compact and easy to learn, and the fact that it doesn't compile to stand alone machine code (instead, to bytecode) makes it cross-platform. |
Bailopan, u seem to know a lot about this kinda stuff. I was always wondering, why ==? Didn't whats his name say nothing can be more equal than =. lol
|
Quote:
= is just to assign a value to a variable like a=0 (you set a to 0) so a=1 b=2 c=a+b (c = 3) if you made that now if (a == b) a = b + 1 else if b < a a = b - 1 etc.... - the << and >> is a byte (i believe) utilisation i use often == (but remind) a == 1 can be if(a) and a == 0 can be if(!a) |
It's a bit more complicated than that...
= is the unary "assignment" operator == is the binary "equal" operator a = b will set b equal to a, and then return a a == b will check if a is equal to b (returning 1 or 0) and in PHP, it gets weirder, there is a === b which checks if two things have the same data type also if (a = b) will return whether b is true if (a == b) will return whether a is equal to b |
I have some things to add :D :
Code:
Code:
and Code:
Code:
When we are talking about operators: All stuff about bit setting / shifting / checking / ... For ilustration i will only use 8 bits: Code:
LOGICAL OR: Basically loops through all bits of two integers and creates a new integer in this way: Code:
LOGICAL AND: Basically loops through all bits of two integers and creates a new integer in this way: Code:
BUT: x && y does basically (x!=0) & (y != 0) ( same with || ) When u write Code:
Code:
You can do the same with '&' ( -> 'x &= y' ) Now you can use these operators to make a "bit sum". Code:
Now we have an 8-byte integer a in which the third and the seventh bits are set. We want to check which bits are set. So we will do: Code:
Code:
Code:
Code:
bit shift left: Code:
Code:
Code:
bit shift right: The same thing, other direction :) So u can use 1 << x to generate values like 1, 2, 4, 8, 16, 32, ... |
wow, very nice write-up PM :)
|
WOW ... WOW ......... WOW. :shock:
|
so.... what is the difference?
|
| All times are GMT -4. The time now is 14:37. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.