GCC

Christos Ricudis ricudis at paiko.gr
Sun Jan 3 15:22:23 EET 1999


Hello all!



  * Forwarded from UNIX.GR
  * Original from Christos Ricudis All
  *          to 03 Jan 99 15:22:09
  *          re. "GCC"
                                      ,,,
                                     (o o)
---------------------------------oOO--(_)--OOo--------------->8-------------


Mia poy sxedon oloi mas sto Unix xrhsimopoioyme th GNU C, de 8a htan wraio na
riksoume mia matia sta proprietary extensions ths? Merika apo ayta einai ontws
xrhsima - alla na 8ymaste pantote oti mporei na kanoyn ton kwdika sas asymbato
me allous compilers :


* Ena syn8eto statement me agkyles mporei na parei th 8esh enos expression,
an to kleisete mesa se paren8eseis (epitrepontai kai local dhlwseis metablhtwn
mesa sto block). To teleytaio pragma sto block prepei na einai ena expression,
h timh toy opoiou epistrefetai gia olh thn paren8esh :

a=({int x,y;for (x=0;x<b;x++) y+=x;y});

Skefteite aplws ti ahdies mporeite na kanete m'ayto to construct mesa sth
syn8hkh enos for loop....


* Mporeite na parete th diey8ynsh enos label me ton telesth && (epistrefei
void *). Fysika to mono xrhsimo pragma poy mporeite na kanete me ena tetoio
pointer, einai ena goto :

void *koko[2]={&&ena,&&dyo);

...

goto *koko[x];

...

ena:
        printf("ena\n");
        return;
dyo:
        printf("dyo\n");
        return;

M'ayto ton tropo mporeite na kanete jump mexri kai se allh function - alla MHN
to kanete :>.


* Nested functions, a-la pascal :

float koko(float a,b) {

        float square(float x) {
                return(x*x);
        }

        return (square(a)+square(b));
}


* Mporeite na breite ton typo mias metablhths, me to statement "typeof()":

int *koko;

typeof(*koko) a; /* isodynamo me int a; */


* Sigoura kserete ti ektrwmata mporeite na ftiaksete me ton conditional
operator (a?b:c). Nai, alla MONO h GNU C sas epitrepei na kanete ayto poy
oneireyosastan sta pio sadistika oneira sas:

int a,b,c;

...

(a==1?b:c) = 5;

Nai, kanei akribws ayto poy fantazeste oti kanei. ekxwrei to 5 sthn
metablhth b h sth metablhth c analogws me thn timh toy a.


* long long int

Xrhsimeyei gia na apo8hkeyete eksairetika pelwwwwria kai teraaaaaaastia
pragmata:

unsigned long long int ricudis_IQ;


* Ari8mhtikh me migadikous (nai!)

__complex__ float a,b,c;

a=a=1.0+2.0i;
b=3.0+4.0i;
c=a*b;

printf("%f + %f i",__real__ c,__imag__ c);


* Arrays metablhtoy mege8ous (nai!)

char *koko[strlen(kuku)];


* Akribws to idio pragma mporeite na kanete kai sto initialization mias
metablhths :

void koko(int i,j) {
        int kuku[2]={i,j};
....
}


* Poly omorfos tropos na kanete initialize ena structure:

struct koko {
        int a;
        int b;
} kuku;

kuku=((struct koko) {1,2});

(telos pia s'ekeina ta ateeeeeleiwta :
        kuku.a=1;
        kuku.b=2;
ktl ktl)


* Sxetiko me to prohgoumeno. Mporeite na kanete initialize ena SYGKEKRIMENO
stoixeio enos pinaka kata th dhlwsh toy  :

int a[5]={[2]=5,[4]=7} ;

ayto einai isodynamo me to

int a[5]={0,0,5,0,7};

Kai mporei na ginei akoma kalytero, giati dexetai ranges :

int a[10]={ [0 ... 4] = 1 , [5 ... 9] = 2};

poy isodynamei me

int a[10]={1,1,1,1,1,2,2,2,2,2);


* Ta idia ranges mporeite na ta xrhsimopoihsete kai sthn case :


case 1 ... 10:
                blabla;


* C++ style comments

// squick squick


* uncommented:

void koko (void) {
        printf("%s\n",__FUNCTION__);
}



--
Christos Ricudis
"Windows has detected that a gnat has farted near your computer. Press any
 key to reboot". - anonymous in ASR.    


----------------------------------------------------------------------------

--
Christos Ricudis
"Windows has detected that a gnat has farted near your computer. Press any
 key to reboot". - anonymous in ASR. 	
--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at argos.hol.gr
Ta archives tis listas einai sto http://www.argos.hol.gr/lists :
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users
====================================================================



More information about the Linux-greek-users mailing list