[cfe-dev] Tracking variable endieness at compile time (C language)

Anatol Pomozov via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 13 16:31:32 PST 2017


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.



More information about the cfe-dev mailing list