>This is from just one source file, which otherwise is "plain C". If I >was to put it into a library that use "asm tweaked fancy pointers", a >portable fragment of code becomes "target dedicated" - this is undesired.
I sympathize with your desire to not lock your codebase to a particular target, I agree, it's important to keep it generic. I would definitely design the library to allow customization of the utilities for a given target. I imagine this gets a little difficult if you're setting up registers a certain way, but wrapping some ASM in a function object, and then forcing the call to that object to inline should do the trick there. From there, any code that you want to remain portable would have to take the pointer type by template parameter. Unfortunately, I can imagine the secondary part of this creating problems in an embedded project if you had to instantiate too many different functions from the templates. >------------------- > y->next = NULL; > if (our) { out->next = a; > for (y = t->HD; y && y->next; y = y->next) > if (y) y->next = a; > fit->HD = a->next; > fit->win = a->next; > b = a->next; >-------------------- I suspect that this snippet that you shared might not be quite as portable as you think. It looks to me like it relies on type punning. Type punning can indeed be implemented in a well defined manner, in my experience though it rarely is. With that said, strict aliasing is very difficult to understand so I would not be surprised if I was mistaken here, especially since there's not enough code in the snippet to be certain. -Alex