Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > size of a sizeof(pointer)

Reply
Thread Tools

size of a sizeof(pointer)

 
 
Malcolm
Guest
Posts: n/a
 
      02-21-2004

"Michael Wojcik" <(E-Mail Removed)> wrote in message
>
> 1. Most C implementations do not check pointer validity.

True.
> 2. Some, however, do; the three I named for the AS/400 are
> examples.

True.
> 3. I feel that (2) is a significant exception to (1).

Fair enough.
> 4. You do not.
> I feel it is a special case, because the C does not compile to machine

code.
> 5. The origin and preferred usage of the phrase "the exception that
> proves the rule" is disputed.
>

The origin may be the legal principle, but etymology isn't meaning. The
proverb is used in two ways, ignorantly to mean that "if a rule has an
exception then that proves the rule must be valid" and correctly "by looking
at seeming exceptions we tell if the rule is valid or not".
>
> 6. However, some people - including myself and some other c.l.c
> readers - feel that when that phrase is used to mean "an
> exception to a general rule demonstrates the validity of that
> rule in other cases", it's somewhat lacking in rhetorical power.
> Other people, of course, may feel differently.
>

It's the difference between the rule "all mammals are viviparous" and "no
mammals are eusocial". Both have exceptions. When we look at oviparous
mammals, the monotremes, we see that they belong to a tiny group that split
off very early and is only included in "mammals" by definiton. We can use
the rule to predict that we won't find an oviparous cat. However when we
look at the eusocial mammals - naked mole rats and, partially, wolves - we
see that there does not appear to be anything special about them. There
doesn't seem to be anything about being a mammal that precludes eusociality,
and if we found a new species of cat we can't be sure it won't be eusocial.




 
Reply With Quote
 
 
 
 
Dave Thompson
Guest
Posts: n/a
 
      02-23-2004
On 15 Feb 2004 18:55:20 GMT, Chris Torek <(E-Mail Removed)> wrote:
<snip>
> Given that we have the word "translator", however, I personally
> would tend to use that word for a system in which the "produce
> something useful" step requires outside assistance, such as a
> C++-to-C step that not only does not come with a C compiler, but
> is provided for a computer for which no C compiler is even available.
> It is probably also worth pointing out that there are a number% of
> compilers that have produced C as their "assembly code", but in
> all cases of which I am aware, that C code was not portable at all
> -- you had to tell the XYZ-to-C step [implementation specifics]


> [%footnote: when I say "a number" I do mean "more than one". While
> cfront is perhaps the best-known example, I believe Xerox PARC had
> C back-ends for some of their compilers, for the language that was
> a followon to Mesa -- I have forgotten its name -- and for Modula-3,
> for instance.]


"most" Eiffels. At least one Ada which I believe is still sold. f2c,
and I think p2c. I believe all Objective C's, and Comeau C++.

And of course any number (well, not *any* <G>) of tools which produce
C code from some other kind of program decription or specification,
like UML or flowcharts or logic diagrams etc. etc., although we (IME)
usually call those generators rather than translators or compilers.

- David.Thompson1 at worldnet.att.net
 
Reply With Quote
 
 
 
 
Dave Thompson
Guest
Posts: n/a
 
      02-23-2004
On Tue, 10 Feb 2004 02:54:58 GMT, pete <(E-Mail Removed)> wrote:
<snip>
> You can't implement the whole standard library,
> if sizeof(int) is one.
>
> putchar(EOF) has to be able to return EOF
> converted to an unsigned char value,
> converted back to a nonnegative int.
>
> http://groups.google.com/groups?selm...andrew.cmu.edu


No, it needs to return any unsigned char value (which need not and
normally does not include EOF) *or* EOF as a signed int. It apparently
was intended, and certainly is traditional, that these are distinct,
i.e. (int)UCHAR_MAX != EOF, but the standard doesn't require it, and
if not, programs using stdio have to be a lot more careful.

AFAWK implementations on which sizeof(int)==1 are all freestanding
ones on platforms where stdio isn't useful, or feasible, or both, so
the issue doesn't arise in practice. And since so few programs (and
programmers) are careful in this way, even if such a hosted (full)
implementation were created it wouldn't be popular unless it had some
huge other benefit(s).

- David.Thompson1 at worldnet.att.net
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      02-23-2004
Dave Thompson wrote:
>
> On Tue, 10 Feb 2004 02:54:58 GMT, pete <(E-Mail Removed)> wrote:
> <snip>
> > You can't implement the whole standard library,
> > if sizeof(int) is one.


> No


That's what they said on comp.std.c too.
I won't be making hosted sizeof(int) claim again.

--
pete
 
Reply With Quote
 
Greg Comeau
Guest
Posts: n/a
 
      02-23-2004
In article <(E-Mail Removed)>,
Dave Thompson <(E-Mail Removed)> wrote:
>On 15 Feb 2004 18:55:20 GMT, Chris Torek <(E-Mail Removed)> wrote:
><snip>
>> Given that we have the word "translator", however, I personally
>> would tend to use that word for a system in which the "produce
>> something useful" step requires outside assistance, such as a
>> C++-to-C step that not only does not come with a C compiler, but
>> is provided for a computer for which no C compiler is even available.
>> It is probably also worth pointing out that there are a number% of
>> compilers that have produced C as their "assembly code", but in
>> all cases of which I am aware, that C code was not portable at all
>> -- you had to tell the XYZ-to-C step [implementation specifics]

>
>> [%footnote: when I say "a number" I do mean "more than one". While
>> cfront is perhaps the best-known example, I believe Xerox PARC had
>> C back-ends for some of their compilers, for the language that was
>> a followon to Mesa -- I have forgotten its name -- and for Modula-3,
>> for instance.]

>
>"most" Eiffels. At least one Ada which I believe is still sold. f2c,
>and I think p2c. I believe all Objective C's, and Comeau C++.
>
>And of course any number (well, not *any* <G>) of tools which produce
>C code from some other kind of program decription or specification,
>like UML or flowcharts or logic diagrams etc. etc., although we (IME)
>usually call those generators rather than translators or compilers.


Indeed there are many. Another is CCsh, a Bourne Shell compiler
that Comeau also sells. Actually, the C code it produces is
extraordinarily portable, however, it depends, heavily, upon a
platform specific library to go along with it, so in the end there
is no escaping it
--
Greg Comeau / Comeau C++ 4.3.3, for C++03 core language support
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
How to set the DataGrid Row Size to a fixed size. =?Utf-8?B?QmlkYXJrb3Rh?= ASP .Net 0 05-19-2005 08:14 PM
Using <asp:label font-size=16px...> ist not showing size in FireFox Browser Andreas Klemt ASP .Net 6 11-28-2004 09:21 PM
Dynamic Size for Text Box - Expanding more than the relative size Madhanmohan S ASP .Net 5 09-03-2004 06:28 AM



Advertisments