J
jacob navia
This document shows its age. I remember complaining here some years ago
about this MSDOS questions but they are still there:
19.17c How can I suppress the dreaded MS-DOS ``Abort, Retry, Ignore?''
message?
19.23 How can I allocate arrays or structures bigger than 64K?
19.24 What does the error message ``DGROUP data allocation exceeds 64K''
mean, and what can I do about it? I thought that using large model meant
that I could use more than 64K of data!
19.29 How do I get an accurate error status return from system on MS-DOS?
19.40b How do I... Use BIOS calls? Write ISR's? Create TSR's?
19.40d What are ``near'' and ``far'' pointers?
MSDOS died some 20 years ago (more or less).
CAN WE GET RID OF THAT?
There is no word about windows/unix/Mac OS X and systems used TODAY...
And there are things like:
7.17 I've got 8 meg of memory in my PC. Why can I only seem to malloc
640K or so?
Theren't a single PC today that is shipped with less than 512K...
most are shipped with 1-4GB, my machine has 12GB. And YES: MSDOS is
dead.
Other answers are just wrong:
11.8: I don't understand why I can't use const values in initializers
and array dimensions, as in
const int n = 5;
int a[n];
The answer given is:
The const qualifier really means ``read-only''; an object so qualified
is a run-time object which cannot (normally) be assigned to. The value
of a const-qualified object is therefore not a constant expression in
the full sense of the term, and cannot be used for array dimensions,
case labels, and the like. (C is unlike C++ in this regard.) When you
need a true compile-time constant, use a preprocessor #define (or
perhaps an enum).
This is plain wrong. You CAN do this within a function in standard C.
That should be mentioned there. ANd NOT only with const but with any
variable of integer type.
Another is:
2.6: I came across some code that declared a structure like this:
struct name {
int namelen;
char namestr[1];
};
and then did some tricky allocation to make the namestr array act like
it had several elements, with the number recorded by namelen. How does
this work? Is it legal or portable?
The answer starts with:
It's not clear if it's legal or portable, but it is rather popular.
And after a page of ramblings comes to:
C99 introduces the concept of a flexible array member, which allows the
size of an array to be omitted if it is the last member in a structure,
thus providing a well-defined solution.
That should be at the beginning, and the whole answer must be changed
to reflect the fact that standard C accepts this!
jacob
about this MSDOS questions but they are still there:
19.17c How can I suppress the dreaded MS-DOS ``Abort, Retry, Ignore?''
message?
19.23 How can I allocate arrays or structures bigger than 64K?
19.24 What does the error message ``DGROUP data allocation exceeds 64K''
mean, and what can I do about it? I thought that using large model meant
that I could use more than 64K of data!
19.29 How do I get an accurate error status return from system on MS-DOS?
19.40b How do I... Use BIOS calls? Write ISR's? Create TSR's?
19.40d What are ``near'' and ``far'' pointers?
MSDOS died some 20 years ago (more or less).
CAN WE GET RID OF THAT?
There is no word about windows/unix/Mac OS X and systems used TODAY...
And there are things like:
7.17 I've got 8 meg of memory in my PC. Why can I only seem to malloc
640K or so?
Theren't a single PC today that is shipped with less than 512K...
most are shipped with 1-4GB, my machine has 12GB. And YES: MSDOS is
dead.
Other answers are just wrong:
11.8: I don't understand why I can't use const values in initializers
and array dimensions, as in
const int n = 5;
int a[n];
The answer given is:
The const qualifier really means ``read-only''; an object so qualified
is a run-time object which cannot (normally) be assigned to. The value
of a const-qualified object is therefore not a constant expression in
the full sense of the term, and cannot be used for array dimensions,
case labels, and the like. (C is unlike C++ in this regard.) When you
need a true compile-time constant, use a preprocessor #define (or
perhaps an enum).
This is plain wrong. You CAN do this within a function in standard C.
That should be mentioned there. ANd NOT only with const but with any
variable of integer type.
Another is:
2.6: I came across some code that declared a structure like this:
struct name {
int namelen;
char namestr[1];
};
and then did some tricky allocation to make the namestr array act like
it had several elements, with the number recorded by namelen. How does
this work? Is it legal or portable?
The answer starts with:
It's not clear if it's legal or portable, but it is rather popular.
And after a page of ramblings comes to:
C99 introduces the concept of a flexible array member, which allows the
size of an array to be omitted if it is the last member in a structure,
thus providing a well-defined solution.
That should be at the beginning, and the whole answer must be changed
to reflect the fact that standard C accepts this!
jacob