N
new to c
Hi!
I write this code cos.c
#include <math.h>
#include <stdio.h>
int main(void)
{
double c;
c = cos(0);
printf("cos(0): %f\n", c);
return 0;
}
I compile normal and it work.
I compile with -pedantic and it not work.
Is -pedantic bad flag?
Is code bug?
I use lcc -pedantic cos.c and he warn
Error cos.c: c:\lcc\include\math.h: 36 Syntax error; missing semicolon before `_cosl'
Warning cos.c: c:\lcc\include\math.h: 36 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 99 Syntax error; missing semicolon before `fabsl'
Warning cos.c: c:\lcc\include\math.h: 99 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 100 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 99 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 100 Syntax error; missing semicolon before `fabsd'
Warning cos.c: c:\lcc\include\math.h: 100 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 101 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 100 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 101 Syntax error; missing semicolon before `fabsf'
Warning cos.c: c:\lcc\include\math.h: 101 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 103 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 101 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 103 Syntax error; missing semicolon before `_fabsi'
Warning cos.c: c:\lcc\include\math.h: 103 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 104 Syntax error; missing semicolon before `_fabsull'
Warning cos.c: c:\lcc\include\math.h: 104 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 105 Syntax error; missing semicolon before `_fabsll'
Warning cos.c: c:\lcc\include\math.h: 105 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 106 Syntax error; missing semicolon before `_fabsu'
Warning cos.c: c:\lcc\include\math.h: 106 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 272 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 106 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 272 Syntax error; missing semicolon before `_signbit'
Warning cos.c: c:\lcc\include\math.h: 272 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 346 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 272 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 346 Syntax error; missing semicolon before `_rint'
Warning cos.c: c:\lcc\include\math.h: 346 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\tgmath.h: 30 too many errors
Is better not use -pedantic? People say -pedantic is good.
I write this code cos.c
#include <math.h>
#include <stdio.h>
int main(void)
{
double c;
c = cos(0);
printf("cos(0): %f\n", c);
return 0;
}
I compile normal and it work.
I compile with -pedantic and it not work.
Is -pedantic bad flag?
Is code bug?
I use lcc -pedantic cos.c and he warn
Error cos.c: c:\lcc\include\math.h: 36 Syntax error; missing semicolon before `_cosl'
Warning cos.c: c:\lcc\include\math.h: 36 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 99 Syntax error; missing semicolon before `fabsl'
Warning cos.c: c:\lcc\include\math.h: 99 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 100 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 99 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 100 Syntax error; missing semicolon before `fabsd'
Warning cos.c: c:\lcc\include\math.h: 100 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 101 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 100 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 101 Syntax error; missing semicolon before `fabsf'
Warning cos.c: c:\lcc\include\math.h: 101 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 103 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 101 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 103 Syntax error; missing semicolon before `_fabsi'
Warning cos.c: c:\lcc\include\math.h: 103 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 104 Syntax error; missing semicolon before `_fabsull'
Warning cos.c: c:\lcc\include\math.h: 104 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 105 Syntax error; missing semicolon before `_fabsll'
Warning cos.c: c:\lcc\include\math.h: 105 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 106 Syntax error; missing semicolon before `_fabsu'
Warning cos.c: c:\lcc\include\math.h: 106 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 272 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 106 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 272 Syntax error; missing semicolon before `_signbit'
Warning cos.c: c:\lcc\include\math.h: 272 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\math.h: 346 redefinition of '_stdcall'
Error cos.c: c:\lcc\include\math.h: 272 Previous definition of '_stdcall' here
Error cos.c: c:\lcc\include\math.h: 346 Syntax error; missing semicolon before `_rint'
Warning cos.c: c:\lcc\include\math.h: 346 no type specified. Defaulting to int
Error cos.c: c:\lcc\include\tgmath.h: 30 too many errors
Is better not use -pedantic? People say -pedantic is good.