問題タブ [memory-safety]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - C++、static_cast を void* に変換してプロセス間で戻すのは安全ですか?
Linux システムで 2 つの同一のバイナリを同時に実行しています (コマンド ライン引数が異なるため、異なる処理を実行しています)。あるプロセスでは、オブジェクトを共有メモリ領域に memcopy します。別のプロセスで、正しいサイズのオブジェクトを取得し、void*
それstatic_cast
へのポインターを として取得し、元の型のポインターへのポインターを取得します。
これは安全と考えられますか? オブジェクトは必ずしも POD ではありません。