[cfe-dev] Tracking variable endieness at compile time (C language)
Nikodemus Siivola via cfe-dev
cfe-dev at lists.llvm.org
Mon Nov 13 23:51:43 PST 2017
Oh, C, well, you *could* write a struct for each type and... yeah. No-one
wants to do that. :)
On Tue, Nov 14, 2017 at 2:31 AM, Anatol Pomozov <anatol.pomozov at gmail.com>
wrote:
> Hello
>
>
> I just filed a bug for this request https://bugs.llvm.org/show_
> bug.cgi?id=35293
>
> I'll be glad to test this feature in my project.
>
> On Mon, Nov 13, 2017 at 10:04 AM, James Dennett <james.dennett at gmail.com>
> wrote:
> > On Sun, Nov 12, 2017 at 11:45 PM, Nikodemus Siivola via cfe-dev
> > <cfe-dev at lists.llvm.org> wrote:
> >>
> >> A solution requiring no compiler support is to wrap the little endian
> >> values in a struct.
> >>
> >> template<typename T>
> >> struct little_endian {
> >> little_endian(T value) : _value(value) {}
> >> T _value;
> >> T convert() {
> >> // conversion here
> >> }
> >> };
>
>
> C does not have templates so it will not work.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171114/2bd64773/attachment.html>
More information about the cfe-dev
mailing list