I'm not aware of any case where sizeof(code) will not work, as 'char' in any usable (with D) C++ compiler has size 1.