Latest OxygenBasic.zip at GitHub (Click on the Wizard)
0 Members and 1 Guest are viewing this topic.
Now, like Bob Zale used to say, if you are not one of those half brain guy, then you should know what to do.
Charles, Not my gccCode: [Select]C:\CodeBlocks\Projects\nestes02\main.c|8|warning: ISO C forbids nested functions [-Wpedantic]|James
C:\CodeBlocks\Projects\nestes02\main.c|8|warning: ISO C forbids nested functions [-Wpedantic]|
Hi James,My rig is a console-and-notepad job:I compile direct with no switches : gcc gosub.cIt compiles to a.exe which is convenient for testing
jrs@laptop:~/o2wine/c_ode$ cat gosub.c #include <stdio.h> int main() { int a; void mygosub() { a=42; } mygosub(); printf("%i\n",a); // 42 }jrs@laptop:~/o2wine/c_ode$ gcc gosub.cjrs@laptop:~/o2wine/c_ode$ ./a.out42jrs@laptop:~/o2wine/c_ode$ file a.outa.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xc51b94741af9cbe04ddca30edae439637b924117, not strippedjrs@laptop:~/o2wine/c_ode$ ls -l a.out-rwxrwxr-x 1 jrs jrs 8416 Oct 23 12:43 a.outjrs@laptop:~/o2wine/c_ode$
Looking at what Microsoft did with Visual Basic (aka. dot.net) some large company needs to step forward with a real professional BASIC compiler. Powerbasic is the perfect candidate.
What would be bad is if Microsoft bought it and just canned it, being a Microsoft OS dependent product.
Even more fun is that you can do something like this:Code: [Select]void foobar(){ int i, x; // a lot of code goes here for (i = x = 0; i < 10; i++) { // even more code goes here if (i % 5) { int x, y, z; // put even more code here x += i; // doing something with x // and some more code here } } // and if the function isn't huge enough, add some more code // to make sure the kitchen sink is included}Now, a good compiler that's set to issue fairly strict warnings should complain about the fact that you're using an uninitialized 'x' ... and you may scratch your head for a second thinking, "hey, I've initialized 'x' at the top of the for loop there!" Then the proverbial light bulb will come on over your head.
void foobar(){ int i, x; // a lot of code goes here for (i = x = 0; i < 10; i++) { // even more code goes here if (i % 5) { int x, y, z; // put even more code here x += i; // doing something with x // and some more code here } } // and if the function isn't huge enough, add some more code // to make sure the kitchen sink is included}
SUB foobar()BEGIN_SUB DIM AS int i, x; // a lot of code goes here FOR (i = x = 0 TO i < 10 STEP i++) BEGIN_FOR // even more code goes here IF (i MOD 5) THEN DIM AS int x, y, z; // initializing variables // put even more code here x += i; // doing something with x // and some more code here END_IF NEXT // and if the function isn't huge enough, add some more code // to make sure the kitchen sink is includedEND_SUB