Accessing public class memory from C++ using C

后端 未结 5 518
旧巷少年郎
旧巷少年郎 2021-01-24 22:27

Greetings Everyone.

I\'m currently writing a multi-language programe in C, C++ and fortran on UNIX, unfortunatly I run into \"Segmentation Error\" when I try and execute

5条回答
  •  失恋的感觉
    2021-01-24 22:44

    Provided you stay within the bounds of the vector, what you are doing would seem to be OK.

    You can treat a std::vector exactly as if it were a C array by doing what you are doing - taking the address of the first element. The C++ Standard has been changed to specifically allow this kind of usage.

    Can't find a copy of C++ the Technical Corrigendum 2003 at present, but apparently the relevant section ref is 23.2.4,

提交回复
热议问题