惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
量子位
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
T
Threatpost
T
Tenable Blog
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
C
Cisco Blogs
H
Heimdal Security Blog
Attack and Defense Labs
Attack and Defense Labs
A
About on SuperTechFans
Last Week in AI
Last Week in AI
N
News and Events Feed by Topic
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
I
Intezer
V
V2EX
Cyberwarzone
Cyberwarzone
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
B
Blog RSS Feed
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
PCI Perspectives
PCI Perspectives
P
Privacy International News Feed
D
Docker

博客园 - Agent

更改VS.NET 默认SCM Provider的方法 关于VS.NET的SCM Plug-in Lippman的宣传 Important Issue About DataReader and DataGrid's Paging 上海照的 cookie的过期时间-- 郁闷又恼火 - Agent - 博客园 可为空的基础类型 Bad Smell 做了一个小型的Dump以便于调试使用 - Agent - 博客园 It's Great VS2005 VS2005 My Assembler 有关JIT 凌晨三点不想睡 不学编程 别搞计算机了 天又要亮了 该死的宏 Uncle bob's View of dynamic and static languages
Choice
Agent · 2004-04-26 · via 博客园 - Agent

本来准备把所有编译错误都写到一个List中,在编译结束后再全部输出。
可发现这样做有好几个缺点:

1. 编译错误与文本行struct Line相联系。如果在一个List中,就会大量插入Line结构。Line结构中保存文本行的大小默认为500byte, 如果错误多起来空间消耗是非常恐怖的。我考虑了使用FlyWeight节省空间,但是如果source文件很大,FlyWeight依然不能给我带来多大优点。编译过程是从文件头一直分析到文件尾,所以我自己的处理过程都只使用了一个Line和两个Token来提高效率, 比其他方法都要优秀的多。节省的空间可以大量使用到HashTable中进行索引。

2. 如果真的用到List中,在调试的时候就不能动态的输出错误信息,也就是说,哑调试,需要自己去查看List操作的正确性以及错误信息,这样造成了极大不便。

3. 已经把错误输出封装为一个OutputError函数,虽然不如用List压入一个Error结构那么简单,但是毕竟也算是一个优雅的方式。为了其他因素牺牲掉一点点的代码冗余,还是比较值得。

ok, ErrList被放弃。