小脚本吧 关注:709贴子:1,521
  • 6回复贴,共1

互相学习,C++

只看楼主收藏回复

stack heap
stack is usually small .depends on your platform and compiler.
C# : struct, value base type
New keyword, 1. Allocate 2. Returns pointer location. Store the Memory Address.
Arrow operator:
Smart pointer , share pointer.


来自iPhone客户端1楼2021-04-08 15:35回复
    堆:Explicitly control obj lifetime.


    来自iPhone客户端2楼2021-04-08 15:36
    回复
      引用这个类的 x,y;
      这就是 this 的类型,Entity * const;
      尝试把 this 赋值给这里的引用;
      const Entity * const 或者 const Entity *
      这是我们关心的;
      如果你在一个不是const 函数中访问它,那么 this 就是 Entity * const 类型;
      你正在从成员函数中释放内存…你会嗝屁,因为内存已经释放了。


      来自iPhone客户端3楼2021-04-09 17:53
      回复
        GLFWAPI is used to declare public API functions for export from the DLL / shared library/ dynamic library.
        /* We are building GLFW as a Win32 DLL. */
        /* We are calling GLFW as a Win32 DLL. */
        /* We are building GLFW as a shared / dynamic library. */
        /* We are building or calling GLFW as a static library. */


        来自iPhone客户端4楼2021-04-12 23:31
        回复
          All configuration — Linker — Input — Additional Dependencies


          来自iPhone客户端5楼2021-04-13 14:42
          回复
            访问的数据在Cache中,称为hit,反之则称为“Miss” 。相比之下,在栈中分配,可能不会得到cache miss.
            在我们请求第一个栈上变量之后,
            在堆上分配内存是一堆的事情,潜在的成本是巨大的。
            因此它们可以放到cpu 缓存线上(cache line 可理解为 CPU Cache 中的最小缓存单位。)
            你的程序需要询问你的操作系统,我需要更多的内存。


            来自iPhone客户端6楼2021-04-16 13:54
            回复
              我们在一个宏中包装了每一个OpenGL的函数调用,所以我们可以自动检查错误,为了跟踪或者调试的目的。
              如果你把new关键字替换成一个自定义的单词,它会自动跟踪,是从哪个文件的哪一行进行的分配。然后分配多大等。
              让C++ 自动推导出数据的类型,不管是在创建、初始化变量数据时。


              来自iPhone客户端7楼2021-04-17 16:53
              回复