Hacker News new | past | comments | ask | show | jobs | submit login

The code can be made portable with a few simple macros (which is why they are implemented they way they are in GCC), though the optimizations will not be.

From the Linux kernel:

    struct boot_params boot_params __attribute__((aligned(16)));

    #if !__GNUC__
    #define __attribute__(x)
    #endif
I think that's a better way to do it than ASM (which totally hoses your portability).



For alignment yes, but that is not the case across all extensions.

Some of them are no different than just writing plain Assembly.


The __builtin_ methods mentioned by the grandparent are functionally identical to the associated libc methods, so they can be #defined away as well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: