Periergh (?) symperifora toy gcc
Giorgos Keramidas
keramida at ceid.upatras.gr
Mon Jun 26 03:39:04 EEST 2000
On Mon, Jun 26, 2000 at 01:56:52AM +0300, Anthony Petropoulos wrote:
>
> Estw elaxisto programmataki:
>
> #include <stdio.h>
> main() {
> float a;
> a=atof("123.45");
> printf("%f\n", a);
> }
>
> To parapanw 6-liner kanei kanonika compile alla bgazei garbage ws
> apotelesma. To problhma dior8wnetai kanontas
> #include <stdlib>
> opoy kai einai orismenh h atof.
>
> Kai h profanhs erwthsh: giati to epa8e ayto o linker? (h atof einai sthn
> glib etsi den einai? Apo oti eida sto stdlib.h an exeis optimization sthn
> bazei inline alla ayto den dikaiologei tipota).
Na apantiso me erotisi, kati tou stul:
"Poios einai o default typos epistrofhs enos function pou den exei
oristei tin stigmh pou to blepei proti fora na xrhsimopoieitai o
compiler?"
- apantisi: int
Tora elpizo na katalabaineis oti mi bazontas to <stdlib.h>, o compiler
theorise oti to atof() epistrefei (int) kai itan san na egrapses:
#include <stdio.h>
int main ()
{
float a = (float)( (int)atof("123.45") );
printf("%f\n", a);
return 0;
}
> Apo dw kai pera gcc -Wall :-)
Ti, theleis na peis oti den exeis CFLAGS="-Wall -ansi -pedantic" sto
environment sou ? Apapapa .... :)
--
Giorgos Keramidas, < keramida @ ceid . upatras . gr >
For my public key: finger keramida at ceid.upatras.gr
--
linux-greek-users mailing list -- http://lists.hellug.gr
More information about the Linux-greek-users
mailing list