random C/C++ question: is there any way to implement the chunking optimization w/o violating strict aliasing?https://github.com/esmil/musl/blob/master/src/string/memcpy.c …
-
-
-
Replying to @johnregehr
@johnregehr Casting from (char*) to any other type is exempted from strict aliasing rules, right?1 reply 0 retweets 0 likes -
Replying to @BRIAN_____
@BRIAN_____ I believe you can only go to char *, not from it1 reply 0 retweets 2 likes -
Replying to @johnregehr
@johnregehr IIUC, if the thing is an "allocated object" then it can be accessed willy-nilly as the lvalue type is the effective type.2 replies 0 retweets 0 likes -
Replying to @BRIAN_____
@johnregehr But, it does seem to mean that using this optimization on anything allocated as `static` or `auto` would be UB. Hard to read.1 reply 0 retweets 1 like -
Replying to @BRIAN_____
@BRIAN_____ hmm, I can't believe that malloced memory is exempt from strict aliasing-- this would defeat almost 100% of the perf benefit3 replies 0 retweets 0 likes -
Replying to @johnregehr
@johnregehr The rules for converting pointers to different types are also relevant, AFAICT.1 reply 0 retweets 0 likes -
Replying to @BRIAN_____
@johnregehr Never mind, I think I'm wrong. I think, indeed, you cannot do the chunking optimization in strict ISO C, in general.2 replies 0 retweets 0 likes -
Replying to @BRIAN_____
@BRIAN_____ are you reading C99 or C11? does C++ differ meaningfully here?1 reply 0 retweets 0 likes
@johnregehr I am reading n1548.pdf.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.