Category : Files from Magazines
Archive   : DDJ0892.ZIP
Filename : NCEG.ASC
Output of file : NCEG.ASC contained in archive : DDJ0892.ZIP
by Robert Jervis
Example 1:
(a)
void f3(int n, float *restrict a, float *b, float *c) {
int i;
for (i = 0; i < n; i++)
a[i] = b[i] + c[i];
}
(b)
float x[100];
float *c;
void f5(int n, float *restrict a, float *restrict b) {
int i;
for (i = 0; i < n; i++)
a[i] = b[i] + c[i];
}
void g5(void) {
float d[100], e[100];
c = x;
f5(100, d, e); /* Behavior defined. */
f5( 50, d, d+50); /* Behavior defined. */
f5( 99, d+1, d); /* Behavior undefined. */
c = d;
f5(100, d, e); /* Behavior undefined. */
f5(100, e, d); /* Behavior defined. */
}
Example 2:
(a)
shape [10][10] Sa;
double:Sa a, b, c;
f() {
double n;
int i;
a = b + c;
n = [4][i]b + 2.0;
where (b < 5){
a++;
c = b;
}
}
(b)
void f(void) {
iterator I = 100;
float a[100], b[100];
a[I] = b[I] + 1;
}
(c)
void f(void) {
int I;
float a[100], b[100];
for (I = 0; I < 100; I++)
a[I] = b[I] + 1;
}
Example 3:
float x, y, z;
long double u, v;
u = (x + y) * (z + v);
Example 4:
double complex x;
x = 3 + 5i;
Example 5:
(a)
void f(int m, float *a) {
... a[i * m + j] ...
}
(b)
void f(int m, float a[m][m]) {
... a[i][j] ...
}
(c)
void f(int n) {
float a[n];
/* ... */
}
Example 6:
(a)
div_t answer = { .quot = 1, .rem = 0 };
(b)
enum etag { Mem1, Mem2, /* ... */ };
const char *nm[] = { [Mem2] = "Mem2", [Mem1] = "Mem1",
/* ... */ };
(c)
int a[MAX] = {
1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
};
(d)
struct s { int a[3], b; };
struct s w[] = { [0].a = { 1 }, [1].a[0] = 2 };
struct s z[] = { { 1 }, 2 };
(e)
union utag { /* ... */ } u = { .any_member = 42 };
(f)
struct point { int x, y };
void drawCircle(struct point center, int radius);
struct point p;
p.x = 11; p.y = 12;
drawCircle(p, 15);
drawCircle((struct point){ 11, 12 }, 15);
Example 7:
int:32 x;
int {1 .. 100} y;
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/