第一章

规则1:C语言,函数中的所有Declare必须在所有Statement之前。

1、几个概念:

1.1 Directives命令

#include <xx> 是头文件命令,命令的一种
#define xx 也是一种命令

参考:
《C Fundamentals》2.2节 p12
详见【header 15.2节】

1.2 Functions函数

1.3 Statements表达式

复合表达式:

详见【compound statement 5.2节】

1.4 Comments注释

1.5 Variables and Assignment变量和赋值

Types

Declarations声明

参考:《C Fundamentals》2.4节 p18

这个C99的新特性,官方叫法是“intermingled declarations and code”,网友也称为“inline variable declarations”
intermingled declarations and code: variable declaration is no longer restricted to file scope or the start of a compound statement (block)
参考:https://en.wikipedia.org/wiki/C99

这个博客里的说法和《C Fundamentals》有区别,说只需要在{}(block)前面定义就好,但我的CCSV3.3的案例也没隔着{},还是不行,博客不太靠谱吧:
https://blog.csdn.net/lansedehuhuan/article/details/7040398

【根据上面陈述,C要求所有的Declaration应该在Statement之前,C99之后,可以Declaration和Statement交替使用】

但是,用CCS3.3还是得先遵守这个规则,否则编译会报错:

估计是这个Compiler太老了。

从CCS论坛查到一个2012年4月的帖子:
https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/181951/how-to-enable-c99-support-in-code-composer

看他这个意思,CCS的编译器是TI Compiler,仅支持到C89、不支持C99【我的理解】
知道什么是TI了,是TEXAS INSTRUMENTS德州电器,CCS的母公司。

如何找到当前CCS3.3的compiler?
参考这个,看起来CCS用的就是TI compiler,但是,目录不一样,没找到:
https://blog.csdn.net/weixin_44915078/article/details/115793932

how to look the compiler of CCS3.3
官方回答:
https://software-dl.ti.com/ccs/esd/documents/sdto_cgt_finding_compiler_options_in_ccs.html

Method1:help没法上网,Method1行不通了。
Method2:在CCS根目录找到了options.txt,但里面根本就没有 --src_interlist,官方案例版本是CCSv9.3,只能说CCSv3.3 is too old

好吧,查了一圈还是没找到CCSV3.3的compiler,也就不知道是否支持C99了。

————
有一条必要不充分条件:
C89不支持后缀,代码中没有U/L等后缀。
C99不加后缀时,表示signed类型,加U才表示unsigned类型。
也没法直接说明CCSV3.3是C98

Assignment

第三章

1、struct

2、typedef

3、typeof
https://www.cnblogs.com/panguchuangshi/p/5836551.html

4、printf
详细介绍见《C语言设计:现代方法》的第3章有详细介绍。

posted on 2022-02-11 08:28  西伯尔  阅读(58)  评论(0)    收藏  举报