免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: whelysee
打印 上一主题 下一主题

[C] 谭浩强的书我就不说什么了,居然教学生include一个.c文件 [复制链接]

论坛徽章:
0
111 [报告]
发表于 2009-10-29 09:23 |只看该作者
打,使劲打,但是道理要辩明白喽,让大伙儿好好学习不要走歪路。

另外庆幸当初只学了一本谭浩强的应付考试,毕业后买的基本是电子工业出版社的xx指南 xx宝典

看到要用某某扩展名便于在编辑器中语法高亮的时候,在喝的开水差点喷到屏幕上

我继续看

论坛徽章:
0
112 [报告]
发表于 2009-10-29 09:36 |只看该作者
原帖由 trainee 于 2009-10-29 09:11 发表
我觉得潭老师不是特意的去教别人include .c
它是告诉别人include .c也是可以的. 它只是没说, "为了规范,最好不要include .c"

如果没有他无意\有意去include.c , 我还真以为include只能跟h. 他这样做,说明他 ...



"但是,xxxxxx.........."  没有说,会害死很多人的。。。。。。。。。。


"啊,左边那条路比右边那条路要短10公里", 但是左边那条路很多障碍却不说出来,走左边的人得吃很多苦头才能到达目的地,这不是害人么

论坛徽章:
0
113 [报告]
发表于 2009-10-29 09:52 |只看该作者
有时还是有include .c文件的需求的。大家可以看看著名的webkit的代码,里面有一个JavaScriptCore模块,它就有一个文件:AllInOneFile.cpp,里面把很多cpp文件全include了。
/*
*  Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
*  This library is free software; you can redistribute it and/or
*  modify it under the terms of the GNU Library General Public
*  License as published by the Free Software Foundation; either
*  version 2 of the License, or (at your option) any later version.
*
*  This library is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*  Library General Public License for more details.
*
*  You should have received a copy of the GNU Library General Public License
*  along with this library; see the file COPYING.LIB.  If not, write to
*  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
*  Boston, MA 02110-1301, USA.
*
*/

// This file exists to help compile the essential code of
// JavaScriptCore all as one file, for compilers and build systems
// that see a significant speed gain from this.

#define KDE_USE_FINAL 1
#define JAVASCRIPTCORE_BUILDING_ALL_IN_ONE_FILE 1
#include "config.h"

// these headers are included here to avoid confusion between ::JSType and JSC::JSType
#include "JSCallbackConstructor.h"
#include "JSCallbackFunction.h"
#include "JSCallbackObject.h"

#include "runtime/JSStaticScopeObject.cpp"
#include "runtime/JSFunction.cpp"
#include "runtime/Arguments.cpp"
#include "runtime/JSGlobalObjectFunctions.cpp"
#include "runtime/PrototypeFunction.cpp"
#include "runtime/GlobalEvalFunction.cpp"
#include "debugger/Debugger.cpp"
#include "runtime/JSArray.cpp"
#include "runtime/ArrayConstructor.cpp"
#include "runtime/ArrayPrototype.cpp"
#include "runtime/BooleanConstructor.cpp"
#include "runtime/BooleanObject.cpp"
#include "runtime/BooleanPrototype.cpp"
#include "runtime/Collector.cpp"
#include "runtime/CommonIdentifiers.cpp"
#include "runtime/DateConstructor.cpp"
#include "runtime/DateMath.cpp"
#include "runtime/DatePrototype.cpp"
#include "runtime/DateInstance.cpp"
#include "wtf/dtoa.cpp"
#include "runtime/ErrorInstance.cpp"
#include "runtime/ErrorPrototype.cpp"
#include "runtime/ErrorConstructor.cpp"
#include "runtime/FunctionConstructor.cpp"
#include "runtime/FunctionPrototype.cpp"
#include "Grammar.cpp"
#include "runtime/Identifier.cpp"
#include "runtime/JSString.cpp"
#include "runtime/JSNumberCell.cpp"
#include "runtime/GetterSetter.cpp"
#include "runtime/InternalFunction.cpp"
#include "runtime/Completion.cpp"
#include "runtime/JSImmediate.cpp"
#include "runtime/JSLock.cpp"
#include "runtime/JSWrapperObject.cpp"
#include "parser/Lexer.cpp"
#include "runtime/ArgList.cpp"
#include "runtime/Lookup.cpp"
#include "runtime/MathObject.cpp"
#include "runtime/NativeErrorConstructor.cpp"
#include "runtime/NativeErrorPrototype.cpp"
#include "runtime/NumberConstructor.cpp"
#include "runtime/NumberObject.cpp"
#include "runtime/NumberPrototype.cpp"
#include "parser/Nodes.cpp"
#include "runtime/JSObject.cpp"
#include "runtime/Error.cpp"
#include "runtime/JSGlobalObject.cpp"
#include "runtime/ObjectConstructor.cpp"
#include "runtime/ObjectPrototype.cpp"
#include "runtime/Operations.cpp"
#include "parser/Parser.cpp"
#include "runtime/PropertySlot.cpp"
#include "runtime/PropertyNameArray.cpp"
#include "runtime/RegExp.cpp"
#include "runtime/RegExpConstructor.cpp"
#include "runtime/RegExpObject.cpp"
#include "runtime/RegExpPrototype.cpp"
#include "runtime/ScopeChain.cpp"
#include "runtime/StringConstructor.cpp"
#include "runtime/StringObject.cpp"
#include "runtime/StringPrototype.cpp"
#include "runtime/UString.cpp"
#include "runtime/JSValue.cpp"
#include "runtime/CallData.cpp"
#include "runtime/ConstructData.cpp"
#include "runtime/JSCell.cpp"
#include "runtime/JSVariableObject.cpp"
#include "wtf/FastMalloc.cpp"
#include "wtf/TCSystemAlloc.cpp"
#include "bytecompiler/BytecodeGenerator.cpp"
#include "interpreter/RegisterFile.cpp"

论坛徽章:
0
114 [报告]
发表于 2009-10-29 10:30 |只看该作者
原帖由 ThinkMachine 于 2009-10-29 09:52 发表
有时还是有include .c文件的需求的。大家可以看看著名的webkit的代码,里面有一个JavaScriptCore模块,它就有一个文件:AllInOneFile.cpp,里面把很多cpp文件全include了。
/*
*  Copyright (C) 2006, 2008  ...


我约摸了一下,对#include .c绝对排斥的有几类:

1. 过分追求完美的
2. 教师
3. 项目经验太少,只弄过几个sample之类的
4. 对可维护性视而不见的
5. 觉的只有 include *.h 才算正统

论坛徽章:
0
115 [报告]
发表于 2009-10-29 10:39 |只看该作者

论坛徽章:
0
116 [报告]
发表于 2009-10-29 10:48 |只看该作者
??????没看明白 呵呵

论坛徽章:
0
117 [报告]
发表于 2009-10-29 11:00 |只看该作者
原帖由 WongMokin 于 2009-10-29 09:36 发表



"但是,xxxxxx.........."  没有说,会害死很多人的。。。。。。。。。。


"啊,左边那条路比右边那条路要短10公里", 但是左边那条路很多障碍却不说出来,走左边的人得吃很多苦头才能到达目的地,这 ...


我不觉得include .c在害人
但我觉得不告诉include .c是在真正害人

论坛徽章:
0
118 [报告]
发表于 2009-10-29 11:13 |只看该作者
原帖由 群雄逐鹿 于 2009-10-29 10:30 发表


我约摸了一下,对#include .c绝对排斥的有几类:

1. 过分追求完美的
2. 教师
3. 项目经验太少,只弄过几个sample之类的
4. 对可维护性视而不见的
5. 觉的只有 include *.h 才算正统



嗯,那你就使劲include c好了。 C语法同时还支持函数内任意goto,你也多用好了。--- C语法允许的事情很多, 你很自由的。

PS,你知道给辩论对方 总结一个心理上的原因, 让我想到什么了吗?

论坛徽章:
0
119 [报告]
发表于 2009-10-29 11:17 |只看该作者
To LS:文字狱?

论坛徽章:
0
120 [报告]
发表于 2009-10-29 11:18 |只看该作者
没有太注意
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP