In case you didn't know, that acronym means "Chapter & Verse"
I'm asking you to support your claim with a citation from
the standard.
Uggle *ptr = 0;
Uggle **uptr = malloc(sizeof(Uggle *));
*uptr = ptr;
*uptr now must be set to NULL. How is this achieved if an Uggle * is of
variable width?
Doesn't matter "how". It must simply 'work correctly'. That's
all the standard requires.
Please don't omit context. Restored:
Malcolm: on a typical system
Mike: Whose definition of 'typical'?
Natural language definition of "typical".
OK I suppose I have to spell it out. Whose definition of
'typical *system*'. In some contexts a 'typical system'
is a PC. In others, it's a cell phone. In the widest
(computer system) context, if 'typical' is the most
widely used, it's certainly not a PC, but more likely
some embedded system I've probably never heard of.
But standard C is deeply dependent on the types of architectures that exist
in the real world.
Not at all. The standard makes requirements that an implementation
must meet. If a platform cannot provide support sufficient for
such an implementation (either directly or via e.g. software emulation,
etc.)
(perhaps it only has 6 bit bytes) then it's simply not possible to create a
conforming C implemenation for it. Period. So you have the 'dependency'
issue exactly backwards.
That's why it has pointers,
I'd have to ask Mr. Ritchie for the 'real' answer, but imo
it has pointers because they allow one to do the useful things
they can do. They implement an abstraction: indirection.
rather than the "advance"
commands that would be expected of Turing machines.
Use of 32 bit pointers to address a 4GB memory space is not just one of many
possible ways to represent such a space. It's the most obvious, natural way
to do so.
You need to understand the physical representation to understand how the
ANSI committee made their decisions.
I need to understand neither physical representation, nor know (or care)
why the committee decided what they did, in order to successfully write
standard C. All I need is a conforming implementation, and access to
the rules (the standard). Of course textbooks written in a more 'prose'
like form are a huge help.
Or else why not say that a pointer is
held in a variable size memory entity?
Because either one would be acceptable with regard to the standard.
It's called flexibility, which I suspect the committe allowed for
when possible. For example why do you suppose there's no hard
definition for the exact representation of '\n'?
NO, because clc is not cl.ansic.
For the zillionth time that I've stated this here, the name of a newsgroup
does *not* define its exact nature. It's only a general guideline.
The nature and guidelines of clc are stated in the 'welcome message',
which has by consensus of the regulars become the defining document.
The newsgriup precedes the ANSI standard,
Irrelevant.
which is proving itself to be an ephemeral chapter in the history of the
language. The C99 standard seems to have failed.
Your opinion. And you seem to have imposed some arbitrary
time limit for C99 to 'succeed'.
Then one would need to ask/read about it where such things are
discussed. Not here.
It's a perfectly on-topic question. I have implemeted a mymalloc() using a
static arena, when a pointer is passed to myfree(), how can I verify that it
is from the arena. The ANSI answer is that you can't, but that's not good
enough.
Tough.
[ debuggers ]
Then one would need to ask/read about it where debuggers are
discussed. Not here.
You need to understand the sorts of ways pointers are represented in memory
before you can understand debuggers,
Debuggers are not topical here.
or indeed the (ANSI) %p format
All one need know is that it will print the value of a type 'void*'
object. The exact display format used is left up to the implemenation.
specifier to the printf() family of functions. Perfectly on topic, but
nothing to do with ANSI.
%p (the ISO specification of it) is indeed topical. Its implementation
is not.
It's the C programming *language* and how to *use* it.
Not ANSI C programming, portable C programming i.e.
compiler-specfic questions are off-topic, but not, for example, "how does a
typical implemetation provide malloc()".
That's an implementation specific issue. The language only
specifies 'malloc()'s *behavior*.
And also comp.lang,c. Otherwise one could simply post the standard in answer
to every query.
So here you are at comp.lang.c where so many experts graciously share
their knowledge and skill, gratis. So instead of desperately trying
to prove yourself "right", why not *listen* and learn? I did.
When I first came to clc, I considered myself, if not 'expert',
at least very knowledgable about C. A couple days here proved
me wrong. I did not allow my ego to obscure or deny this fact.
Well done but that's unusual,
I suppose one might call it "unusual". I found my instructor's
methods to be brilliant.
and an inefficient way of learning.
I suppose that depends upon what you mean by "efficient". Fast?
Fast just means fast, not necessarily "good".
I found it a very *effective* way to learn.
Basically
you are using the tutor to dry run code,
Actually the students all used one another to represent
system components, one of which was the CPU, who was
given a sequence of predefined instructions. Others
represented data objects, peripheral devices, etc.
We 'executed' a 'program' according to a strict
formal set of rules (analagous to a standard
language specification). But these rules did *not*
mandate implementation methods. E.g. a the person
representing an 'accumulator' was only required
to 'reset', 'accumulate', and report a value.
It was not mandated *how* to do so. He was free
to rely on his memory, or he could write things
down, or use a handheld calculator, etc.
and he will do so several million
times slower than a processor.
Speed was not the objective. Learning was.
And after the students all having participated
in the 'execution' of a 'program' we all had a
much better appreciation for the true power
of a computer, and the discipline required to
effectively program one.
Programming is a practical skill,
Yes, and a programming language is only a small part of it.
This newsgroup provides only a small part of the knowledge
necessary. Other learning resources exist for the other
issues.
which means that you need to understnad
your implementation.
Not to use C you don't.
Otherwise we could simply hand a copy of the standard
to every newbie and expect them to become proficient C programmers. It
doesn't work like that.
As I already said, that's why we have schools, books, instructors, etc.
Basically engage brain before trying to obfuscate my explanations
I have in no way tried to obfuscate anything you've 'explained'.
I've only debated your opinions.
with
references to URL pointers and other such rubbish.
I made no reference to a URL pointer.
-Mike