public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "John S. Fine" <johnsfine@verizon.net>
To: gcc-help@gcc.gnu.org
Cc: Reza Roboubi <reza@parvan.net>
Subject: Re: short pointers (32 bit) in 64 bit apps
Date: Thu, 20 May 2010 02:29:00 -0000	[thread overview]
Message-ID: <4BF47226.8020505@verizon.net> (raw)
In-Reply-To: <4BF42C4C.2050606@parvan.net>

Reza Roboubi wrote:
> Trust me, doing this in the compiler is a _much_ more sane, easy to 
> implement, and clean solution.
Trust me instead.  Using C++ and a templated type for the short pointer 
is easy.  Modifying the compiler is hard.   They aren't anywhere close 
to a scale where you might reach the opposite conclusion.

If this were a common requirement (both to save that space despite the 
complications and restrictions, and to do so for programs written in C, 
not C++) then there might be a case to do a difficult project in the 
compiler instead of many people doing simpler projects in their own 
code.  But I doubt you will convince any experienced GCC maintainer that 
this will be a common requirement.
> If you use C++ templates, it can get crazy very quickly:  imagine 
> trying to reference this template based object (using a void short **) 
> (for passing to a generic function like memcpy.)
The template would obviously have a conversion operator to the correct 
type of ordinary pointer, which you might further cast to void* if you 
wanted to use it with memcpy etc.  But I can't think of any reason you 
might want anything like void short** to ever exist.

> It's an awful mess!  The more you try to "fix" it, the more you 
> realize it's broken.  The reason is that this 
> "type-first-logic-second" mentality of C++ is just WRONG at a 
> fundamental level, and that cannot be fixed.
I won't try further to fix your bias against C++, I assume that wouldn't 
be possible.

      reply	other threads:[~2010-05-19 23:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17  9:51 Reza Roboubi
2010-05-18 14:45 ` Ian Lance Taylor
2010-05-19  5:58   ` Reza Roboubi
2010-05-19  8:27     ` Ian Lance Taylor
2010-05-19  8:55     ` Nicholas Sherlock
2010-05-19  9:24       ` Reza Roboubi
2010-05-19  9:46         ` Nicholas Sherlock
2010-05-19 18:34           ` Reza Roboubi
2010-05-19 21:24             ` Clemens Eisserer
2010-05-19 21:29               ` phi benard
2010-05-24 21:52                 ` Clemens Eisserer
2010-05-20  3:16             ` Ian Lance Taylor
2010-05-20 11:36               ` Nicholas Sherlock
2010-05-19  9:50         ` Andrew Haley
2010-05-19 19:08           ` Reza Roboubi
2010-05-20  2:29             ` John S. Fine [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BF47226.8020505@verizon.net \
    --to=johnsfine@verizon.net \
    --cc=gcc-help@gcc.gnu.org \
    --cc=reza@parvan.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).