fxm wrote:Last attempt for me (this strange and twisted use of Union is not very exciting):
Code: Select all
Anyway it seems that you made it work.
I don't know from my part if it is strange or twisted , I just can't see a really useful other usage of Unions beyond the color example (I'm obviously a great ignorant in this but it's how it is at the day of today). By the way we learnt a lot on number representation in memory, on zstrings and strings with some details that are exhibited here crudely that may be very hard to see otherwise (like null bytes issues, in the middle of the string as well as for terminators in zstrings).
About the converting excercise, even if it's surprisingly hard to twist as you say, I think that the hardest part is done with the converting to the base-256. Now that you've helped a lot with this case, I'll try when I'll have some time to add the other 8n bases. This is a recurrent issue to convert a number into another representation around here. I think that this case was a little extreme, but the base 128 could be quite useful to solve (easier?).