public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Integral type with sizeof(T) == 1 and distinct aliasing class
@ 2012-05-20  9:45 Florian Weimer
  2012-05-21  4:06 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2012-05-20  9:45 UTC (permalink / raw)
  To: gcc-help

Is there a type which is basically an (unsigned) char, but with the
additional feature that a pointer derived from it wouldn't alias with
basically anything?

This type would be handy for optimizing marshaling code.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Integral type with sizeof(T) == 1 and distinct aliasing class
  2012-05-20  9:45 Integral type with sizeof(T) == 1 and distinct aliasing class Florian Weimer
@ 2012-05-21  4:06 ` Ian Lance Taylor
  2012-05-25 20:01   ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2012-05-21  4:06 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

Florian Weimer <fw@deneb.enyo.de> writes:

> Is there a type which is basically an (unsigned) char, but with the
> additional feature that a pointer derived from it wouldn't alias with
> basically anything?
>
> This type would be handy for optimizing marshaling code.

There is no such type.  However, use of the restrict qualifier should
achieve a similar effect.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Integral type with sizeof(T) == 1 and distinct aliasing class
  2012-05-21  4:06 ` Ian Lance Taylor
@ 2012-05-25 20:01   ` Florian Weimer
  2012-05-25 20:41     ` Gabriel Dos Reis
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2012-05-25 20:01 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

* Ian Lance Taylor:

> Florian Weimer <fw@deneb.enyo.de> writes:
>
>> Is there a type which is basically an (unsigned) char, but with the
>> additional feature that a pointer derived from it wouldn't alias with
>> basically anything?
>>
>> This type would be handy for optimizing marshaling code.
>
> There is no such type.  However, use of the restrict qualifier should
> achieve a similar effect.

It turns out that I can't get GCC to eliminate redundant bounds
checks, no matter what the type is.  I guess I have to do this in a
library after all, using template metaprogramming.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Integral type with sizeof(T) == 1 and distinct aliasing class
  2012-05-25 20:01   ` Florian Weimer
@ 2012-05-25 20:41     ` Gabriel Dos Reis
  0 siblings, 0 replies; 4+ messages in thread
From: Gabriel Dos Reis @ 2012-05-25 20:41 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Ian Lance Taylor, gcc-help

On Fri, May 25, 2012 at 3:01 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
> * Ian Lance Taylor:
>
>> Florian Weimer <fw@deneb.enyo.de> writes:
>>
>>> Is there a type which is basically an (unsigned) char, but with the
>>> additional feature that a pointer derived from it wouldn't alias with
>>> basically anything?
>>>
>>> This type would be handy for optimizing marshaling code.
>>
>> There is no such type.  However, use of the restrict qualifier should
>> achieve a similar effect.
>
> It turns out that I can't get GCC to eliminate redundant bounds
> checks, no matter what the type is.  I guess I have to do this in a
> library after all, using template metaprogramming.

is it possible to use one of those GCC type mode extensions to
typedef int with mode saying it has 8-bit and use that?

-- Gaby

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-25 20:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-20  9:45 Integral type with sizeof(T) == 1 and distinct aliasing class Florian Weimer
2012-05-21  4:06 ` Ian Lance Taylor
2012-05-25 20:01   ` Florian Weimer
2012-05-25 20:41     ` Gabriel Dos Reis

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).