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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - Agent

更改VS.NET 默认SCM Provider的方法 关于VS.NET的SCM Plug-in Lippman的宣传 Important Issue About DataReader and DataGrid's Paging 上海照的 - Agent 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被放弃。