Files
scuc-qt-course/tools/wiki_data/bodies/58954438.json
T
张宗平 13b3ebbe14 课程代码仓库初始化:Part1 (144) + Part3 (29) 全量生成与验证
把川大 wiki「02.Qt方向」课程代码整理为 CMake 管理的可编译运行项目。

Part1 C/C++ 强化 (p01/, 144 目标, host gcc/g++ 构建, 全绿):
- 修复全部编译失败:补 <cstring>/<fstream>/<iomanip>/<vector> 等缺失头
  (common_fix + infer_stl_includes 自动检测注入)、修正 pause() 壳注入
  (改检测已转换后的 pause 调用)、namespace 提升出函数体、const 成员函数
  正确性、dedupe 不再破坏函数重载集、K&R 隐式 int / 动态异常规范等
  C++17 移除特性的可编译等价改写。
- 目录采用深缩写 p01/ch04/s03/ (原 part1_cpp/ch04_class_object/03_ctor_dtor)。

Part3 Qt 桌面 (p03/, 29 目标, 隔离 Qt 5.14.2 构建, 全绿):
- gen_part3.py: Qt 外壳模板 (main+QApplication+show, QTimer 自动退出便于
  offscreen 验证)、AUTOMOC + .moc include、rewrite_* 处理散文混入/重载/
  资源依赖、生成占位 png/gif + .qrc + rundata 样例数据。
- 修正 QLable 笔误、全角分号、.→->、Windows 路径、QApplication 阻塞事件
  循环改为 QCoreApplication 等。

任务1 概念/版本验证:
- tools/std_probe.py: 跨 -std= 编译探针 (--pedantic-errors 让已废除特性硬失败)。
- tools/demo_versions/: K&R 隐式 int、三目左值、void* 转换、enum 赋整、
  const 经指针、动态异常规范 共 6 个跨版本演示。
- docs/VERSION_NOTES.md: 每条「原文说法→C17/C++17 是否成立→何版本成立→已验证」。

文档: 顶层 README、docs/SOURCE_PAGES.md (页面→目录映射)、
docs/ERRATA.md (Part1 修正)、docs/ERRATA_part3.md (Part3 修正)。
另修复 tools/run.sh / run_qt.sh 的 ${1:?...} 引号语法 bug。

隔离 Qt 验证: ldd 0 系统 Qt 引用; 173/173 目标全绿; p03 offscreen 运行通过。
2026-06-30 14:16:55 +08:00

1 line
5.1 KiB
JSON
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"id":"58954438","type":"page","status":"current","title":"02.C++初识","version":{"by":{"type":"known","username":"ethanliu","userKey":"2c90931b6cfb654f016d5c69becc0001","profilePicture":{"path":"/images/icons/profilepics/default.svg","width":48,"height":48,"isDefault":true},"displayName":"刘浩","_links":{"self":"https://wiki.suncaper.net/rest/api/user?key=2c90931b6cfb654f016d5c69becc0001"},"_expandable":{"status":""}},"when":"2022-07-09T01:51:24.000Z","message":"","number":1,"minorEdit":false,"hidden":false,"_links":{"self":"https://wiki.suncaper.net/rest/experimental/content/58954438/version/1"},"_expandable":{"content":"/rest/api/content/58954438"}},"body":{"storage":{"value":"<ac:layout><ac:layout-section ac:type=\"two_right_sidebar\"><ac:layout-cell><h2><span>2.1 </span>简单的<span>c++</span>程序</h2><h3><span>2.1.1 c++ hello world</span></h3><ac:structured-macro ac:name=\"code\" ac:schema-version=\"1\" ac:macro-id=\"ffbdaf69-969c-4ee8-b2a6-ef338cc11b9a\"><ac:parameter ac:name=\"language\">cpp</ac:parameter><ac:plain-text-body><![CDATA[#include<iostream>\nusing namespace std;\n\nint main(){\t\n\tcout << \"hello world\" << endl;\n\treturn EXIT_SUCCESS;\n}]]></ac:plain-text-body></ac:structured-macro><ul><li>#include&lt;iostream&gt;;     预编译指令,引入头文件</li><li>using namespace std; 使用标准命名空间\\</li><li>cout &lt;&lt; “hello world”&lt;&lt; endl; 和<span>printf</span>功能一样,输出字符串<span>”hello wrold”</span></li></ul><h3><span>2.1.2 </span>面向过程</h3><p>面向过程是一种以过程为中心的编程思想。</p><p>通过分析出解决问题所需要的步骤,然后用函数把这些步骤一步一步实现,使用的时候一个一个依次调用就可以了。</p><p>面向过程编程思想的核心:功能分解,自顶向下,逐层细化(程序=数据结构+算法)。</p><p>面向过程编程语言存在的主要缺点是不符合人的思维习惯,而是要用计算机的思维方式去处理问题,而且面向过程编程语言重用性低,维护困难。</p><h3><span>2.1.3 </span>面向对象</h3><p><strong>面向对象编程</strong>Object-Oriented Programming)简称 OOP 技术,是开发计算机应用程序的一种新方法、新思想。过去的面向过程编程常常会导致所有的代码都包含在几个模块中,使程序难以阅读和维护。在做一些修改时常常牵一动百,使以后的开发和维护难以为继。而使用 OOP 技术,常常要使用许多代码模块,每个模块都只提供特定的功能,它们是彼此独立的,这样就增大了代码重用的几率,更加有利于软件的开发、维护和升级。</p><p>在面向对象中,算法与数据结构被看做是一个整体,称作对象,现实世界中任何类的对象都具有一定的属性和操作,也总能用数据结构与算法两者合一地来描述,所以可以用下面的等式来定义对象和程序:</p><p>对象 = 算法 + 数据结构</p><p>程序 = 对象 + 对象 + ……</p><p>从上面的等式可以看出,程序就是许多对象在计算机中相继表现自己,而对象则是一个个程序实体。</p><p>面向对象编程思想的核心:应对变化,提高复用。</p><p><br /></p><h3><span>2.1.4 </span>面向对象三大特性</h3><ul><li>封装</li></ul><p style=\"margin-left: 60.0px;\">把客观事物封装成抽象的类,并且类可以把自己的数据和方法只让可信的类或者对象操作,对不可信的进行信息隐藏。</p><p style=\"margin-left: 60.0px;\">类将成员变量和成员函数封装在类的内部,根据需要设置访问权限,通过成员函数管理内部状态。</p><ul><li>继承</li></ul><p style=\"margin-left: 60.0px;\">继承所表达的是类之间相关的关系,这种关系使得对象可以继承另外一类对象的特征和能力。</p><p style=\"margin-left: 60.0px;\">继承的作用:避免公用代码的重复开发,减少代码和数据冗余。</p><ul><li>多态</li></ul><p style=\"margin-left: 60.0px;\">多态性可以简单地概括为“一个接口,多种方法”,字面意思为多种形态。程序在运行时才决定调用的函数,它是面向对象编程领域的核心概念。</p></ac:layout-cell><ac:layout-cell><p><br /></p></ac:layout-cell></ac:layout-section></ac:layout>","representation":"storage","_expandable":{"content":"/rest/api/content/58954438"}},"_expandable":{"editor":"","view":"","export_view":"","styled_view":"","anonymous_export_view":""}},"extensions":{"position":"none"},"_links":{"webui":"/pages/viewpage.action?pageId=58954438","edit":"/pages/resumedraft.action?draftId=58954438","tinyui":"/x/xpKDAw","collection":"/rest/api/content","base":"https://wiki.suncaper.net","context":"","self":"https://wiki.suncaper.net/rest/api/content/58954438"},"_expandable":{"container":"/rest/api/space/2CT","metadata":"","operations":"","children":"/rest/api/content/58954438/child","restrictions":"/rest/api/content/58954438/restriction/byOperation","history":"/rest/api/content/58954438/history","ancestors":"","descendants":"/rest/api/content/58954438/descendant","space":"/rest/api/space/2CT"}}