随笔分类 -  C++

记录学习过程
摘要:测试代码structpass.cpp struct Vertex { int x, y, z; }; Vertex getVertex(Vertex a) { a.x = 111; a.z = 222; return a; } int main() { Vertex t; t.x = 1; t.y 阅读全文
posted @ 2022-09-23 00:15 哇哩顾得 阅读(132) 评论(0) 推荐(0)
摘要:本文主要从汇编的角度,看C++类的内存模型,即C++类的各种数据是如何分布的。 ####1.假设有如下Cpp文件: classMemoryLayout.cpp class Base { public: Base(){} virtual int func1() = 0; virtual int fun 阅读全文
posted @ 2022-08-30 22:39 哇哩顾得 阅读(210) 评论(0) 推荐(0)
摘要:本文主要从汇编的角度,看C++的类是如何实现的。 ####1.假设有如下Cpp文件 点击查看代码 //file:fraction.h class fraction { public: fraction(); int public_int; int getprivate(); void setpub( 阅读全文
posted @ 2022-08-21 22:08 哇哩顾得 阅读(144) 评论(0) 推荐(0)
摘要:本文主要描述了X64下的汇编层面的方法调用。具体来说就是一个C语言的方法被另外一个方法调用,是如果在汇编语言X64的规范中实现的。 1.假设有如下C语言文件 "test.c" 点击查看代码 int sumNine(int one, int two, int three, int four, int 阅读全文
posted @ 2022-08-20 23:21 哇哩顾得 阅读(110) 评论(0) 推荐(0)
摘要:1.0基本的指令 movx 单纯的copy %al = [10000000] %bl = [00000000] movb %al, %bl after %al = [10000000] %bl = [00000000] movsxx copy并且进行sign扩展 %al = [10000000] % 阅读全文
posted @ 2021-12-08 17:59 哇哩顾得 阅读(227) 评论(0) 推荐(0)
摘要:-o //输出名字 -I //头文件 -L //库文件的位置 -i /// 使用哪个库 gcc -E hello.c -o hello.i //头文件与源代码合在一起 gcc -S hello.i -o hello.s //汇编 gcc -c add.c -o add.o //编译成机器码 gcc 阅读全文
posted @ 2021-02-25 21:29 哇哩顾得 阅读(110) 评论(0) 推荐(0)