Skip to content

fix: 修复 code review 剩余问题#12

Merged
CPythoner merged 1 commit intomasterfrom
fix/remaining-issues
Apr 3, 2026
Merged

fix: 修复 code review 剩余问题#12
CPythoner merged 1 commit intomasterfrom
fix/remaining-issues

Conversation

@CPythoner
Copy link
Copy Markdown
Owner

修复内容

根据 code review 的反馈,修复了以下剩余问题:

错误处理改进

  • 添加 <stdexcept> 头文件
  • 使用 std::bad_alloc 替代 exit(1) 处理内存分配失败

代码质量改进

  • 添加 MARK_UNSET 常量(值为 UINT32_MAX)替代 magic number -1
  • mark_ 类型从 int32_t 改为 uint32_t

文档更新

  • 更新 README 添加内存对齐说明
  • 更新 README 添加异常处理说明

Code Review 问题修复状态

问题 状态 PR
严格别名问题 ✅ 已修复 PR #8
缺少拷贝构造函数 ✅ 已修复 PR #10
position() 缺少返回值 ✅ 已修复 PR #8
getBytes 性能问题 ✅ 已修复 PR #7
使用 NULL 而非 nullptr ✅ 已修复 PR #10
使用 C 风格转换 ✅ 已修复 PR #10
构造函数中重复初始化 ✅ 已修复 PR #10
头文件包含不完整 ✅ 已修复 PR #10
宏定义而非 constexpr ✅ 已修复 PR #10
hasRemaining() 缺少 const ✅ 已修复 PR #10
错误处理过于简单 ✅ 已修复 本 PR
Magic number -1 ✅ 已修复 本 PR
内存对齐说明 ✅ 已添加 本 PR

- 添加 <stdexcept> 头文件
- 使用 std::bad_alloc 替代 exit(1) 处理内存分配失败
- 添加 MARK_UNSET 常量替代 magic number -1
- 将 mark_ 类型从 int32_t 改为 uint32_t
- 更新 README 添加内存对齐和异常处理说明
@CPythoner CPythoner merged commit 0cce3dd into master Apr 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant