|
From: Ioannis V. <no...@ya...> - 2001-01-02 18:47:27
|
Except of the long long type which corrupts compatibility with C89 & C++,
and the _Bool type defined only in boolean.h (not built in type) which may
or may not be stupid, there are a lot of fortran-style!!! stupid additions
which corrupt compatibility with common sense and according to my opinion
destroyed forever the language.
Examples:
1) snprintf()
2) new formats for printf(). E.g. %ll for long long. We are used to %$d
stuff for signed integers, where $ the integer type, so %ll is something you
have to remember isolated.
And now fasten your seabelt, "the great things" adopted by fortran:
3) int *p=(int []) {2, 4}
It is something like a pointer pointing to an array where the first 2
elements are 2, 4. Or something like that, i do not know and i do not want
to know..
4) int (*q)[2]=(int[][2]) {{1,2}, {3,4}, {5,6}, {7, 8}};
It is something an array of 2 pointers to functions accepting an int
2-dimensional array with default values?
5) drawline((struct point) {1, 2}, (struct point) {3, 4});
It is a function accepting two *anonymous*(!) probably variable structs with
default values?
6) drawline((struct point) {.y=2, .x=1}, (struct point) {.x=3, .y=});
This creates 2 anonymous structs with those values. The structs and the
values are created in there!!
7) int a[]={[2]=3, [1]=2, [0]=1};
Translation: We create an array with the third element=3, the second=2, and
the first=1. The same we used till nowadays as int a[]={1, 2, 3};
8) enum{ first, second};
const char *nm[]={[second]="second", [first]="first",};
Translation: The second element of the array gets the value "second" and the
first the value "first".
I wonder why the last comma (,) is used but perhaps it is a variable array
or something.
9) int a[MAX]={1, 3, 5, [MAX-3]= 4, 2, 0};
The "fortan-miracles" of the new standard: We give to the first 3 elements
of the array the values 1, 3, 5 and the 3 elements at the end the values 4,
2, and 0.
10) struct {int a[2], b}; x[]={[0].a = {1}, [1].a[0] = 2};
I will try to translate this: We create an anonymous struct and then an
array of it named x, with the first element taking the values: [0].a[0]=1 &
[0].a[1]=1 both using the notation [0].a=1 , and the second elemet of the
structure array x taking the value 1 at its first only array element:
[1].a[0]=2
11)
size_t fsize3(int n)
{
char b[n+3]; // Variable Length (Fortran-style) Array
return sizeof b;
}
int main()
{
size_t size=fsize3(10); // 13
return 0;
}
12)
void rowSum(int, int, int[*][*], int[*]);
// ^^^^^^^^^ means variable length
...
int a[5][6], b[5];
rowSum(5, 6, a, b,);
...
void rowSum(int n, int m, int in[n][m], int out[n])
// ^^^^^^^^^ here we give names to the lengths
{
for(int i=0; i<n; i++)
{
int sum=0;
for(j=0; j<m; j++)
sum+=in[i][j];
out[i]=sum;
}
}
13) Old Fortran trick:
struct s { int n; double d[]; };
struct s *s1=malloc(sizeof(struct s)+64);
s1->d[0]=...
Translation: We allocated space for the struct and 64 bytes for the double
type array.
14) Exact width integers: int_least_8t (also 16, 32, 64)
uint_least_8t (also 16, 32, 64)
Fast minimum width integers: int_fast_8t (also 16, 32, 64)
uint_fast_8t (also 16, 32, 64)
Greatest width integers (the largest integer): intmax_t, uintmax_t.
15) restricted pointers. They assure that no other pointer points to the
same data.
There are many other changes too. I got all these from
http://www.freshsources.com/dev/Forums/C99/
Go and take a look there, it has a summary of the changes.
I would like to see what the others (you) believe about these improvements.
Ioannis
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of James
> Gordon
> Sent: Tuesday, January 02, 2001 3:54 PM
> To: 'dev...@li...'
> Subject: RE: [Dev-C++] C99
>
>
> For instance?
>
> Regards,
>
> James.
>
>
>
> -----Original Message-----
> From: Ioannis Vranos [mailto:no...@ya...]
> Sent: Saturday, December 30, 2000 12:17 PM
> To: Dev-C++
> Subject: [Dev-C++] C99
>
>
> Talking about C, has anybody in here realized what crap has been
> introduced
> in C, in C99 standard? The language has been totally ruined. Now i
> completely understand why K&R will not write a new book.
>
>
> Ioannis
>
> * Ioannis Vranos
> * Programming pages: http://members.nbci.com/noicys
> <http://members.nbci.com/noicys>
> * Alternative URL: http://run.to/noicys <http://run.to/noicys>
>
>
>
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> This electronic message and any attachment is intended to be
> read by the named addressee(s) only.
> Any other recipient should be aware that its contents may be
> legally privileged and/or confidential and that its use,
> disclosure, copying or distribution may be unlawful.
> Unless you are a named addressee, please delete this message
>
> Whilst C. & J. Clark International Limited has taken steps
> to prevent the transmission of computer viruses with electronic mail,
> responsibility for screening incoming messages and the risk of such
> transmission and its consequences lies with the recipient.
>
> C. & J. Clark International Limited
> Registered in England and Wales
> Company No. 141015
> Registered Office: 40 High Street, Street, Somerset BA16 0YA
> Telephone: +44 (0) 1458 443131
> Fax: +44 (0) 1458 447547
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users
>
|