C++ typedef用法小结

时间:2019-05-12 15:05:49下载本文作者:会员上传
简介:写写帮文库小编为你整理了多篇相关的《C++ typedef用法小结》,但愿对你工作学习有帮助,当然你在写写帮文库还可以找到更多《C++ typedef用法小结》。

第一篇:C++ typedef用法小结

第一、四个用途 用途一:

定义一种类型的别名,而不只是简单的宏替换。可以用作同时声明指针型的多个对象。比如: char* pa, pb;// 这多数不符合我们的意图,它只声明了一个指向字符变量的指针,// 和一个字符变量; 以下则可行:

typedef char* PCHAR;// 一般用大写

PCHAR pa, pb;// 可行,同时声明了两个指向字符变量的指针 虽然:

char *pa, *pb;也可行,但相对来说没有用typedef的形式直观,尤其在需要大量指针的地方,typedef的方式更省事。用途二:

用在旧的C的代码中(具体多旧没有查),帮助struct。以前的代码中,声明struct新对象时,必须要带上struct,即形式为: struct 结构名对象名,如: struct tagPOINT1 { int x;int y;};struct tagPOINT1 p1;

而在C++中,则可以直接写:结构名对象名,即: tagPOINT1 p1;

估计某人觉得经常多写一个struct太麻烦了,于是就发明了: typedef struct tagPOINT { int x;int y;}POINT;

POINT p1;// 这样就比原来的方式少写了一个struct,比较省事,尤其在大量使用的时候

或许,在C++中,typedef的这种用途二不是很大,但是理解了它,对掌握以前的旧代码还是有帮助的,毕竟我们在项目中有可能会遇到较早些年代遗留下来的代码。用途三:

用typedef来定义与平台无关的类型。

比如定义一个叫 REAL 的浮点类型,在目标平台一上,让它表示最高精度的类型为: typedef long double REAL;

在不支持 long double 的平台二上,改为: typedef double REAL;

在连 double 都不支持的平台三上,改为: typedef float REAL;

也就是说,当跨平台时,只要改下 typedef 本身就行,不用对其他源码做任何修改。标准库就广泛使用了这个技巧,比如size_t。

另外,因为typedef是定义了一种类型的新别名,不是简单的字符串替换,所以它比宏来得稳健(虽然用宏有时也可以完成以上的用途)。用途四:

为复杂的声明定义一个新的简单的别名。方法是:在原来的声明里逐步用别名替换一部分复杂声明,如此循环,把带变量名的部分留到最后替换,得到的就是原声明的最简化版。举例: 1.原声明:int *(*a[5])(int, char*);变量名为a,直接用一个新别名pFun替换a就可以了: typedef int *(*pFun)(int, char*);原声明的最简化版: pFun a[5];

2.原声明:void(*b[10])(void(*)());变量名为b,先替换右边部分括号里的,pFunParam为别名一: typedef void(*pFunParam)();再替换左边的变量b,pFunx为别名二: typedef void(*pFunx)(pFunParam);原声明的最简化版: pFunx b[10];

3.原声明:doube(*)()(*e)[9];

变量名为e,先替换左边部分,pFuny为别名一: typedef double(*pFuny)();再替换右边的变量e,pFunParamy为别名二 typedef pFuny(*pFunParamy)[9];原声明的最简化版: pFunParamy e;

理解复杂声明可用的“右左法则”:

从变量名看起,先往右,再往左,碰到一个圆括号就调转阅读的方向;括号内分析完就跳出括号,还是按先右后左的顺序,如此循环,直到整个声明分析完。举例: int(*func)(int *p);首先找到变量名func,外面有一对圆括号,而且左边是一个*号,这说明func是一个指针;然后跳出这个圆括号,先看右边,又遇到圆括号,这说明(*func)是一个函数,所以func是一个指向这类函数的指针,即函数指针,这类函数具有int*类型的形参,返回值类型是int。int(*func[5])(int *);func右边是一个[]运算符,说明func是具有5个元素的数组;func的左边有一个*,说明func的元素是指针(注意这里的*不是修饰func,而是修饰func[5]的,原因是[]运算符优先级比*高,func先跟[]结合)。跳出这个括号,看右边,又遇到圆括号,说明func数组的元素是函数类型的指针,它指向的函数具有int*类型的形参,返回值类型为int。也可以记住2个模式: type(*)(....)函数指针 type(*)[]数组指针 第二、两大陷阱 陷阱一:

记住,typedef是定义了一种类型的新别名,不同于宏,它不是简单的字符串替换。比如: 先定义:

typedef char* PSTR;然后:

int mystrcmp(const PSTR, const PSTR);

const PSTR实际上相当于const char*吗?不是的,它实际上相当于char* const。原因在于const给予了整个指针本身以常量性,也就是形成了常量指针char* const。简单来说,记住当const和typedef一起出现时,typedef不会是简单的字符串替换就行。陷阱二:

typedef在语法上是一个存储类的关键字(如auto、extern、mutable、static、register等一样),虽然它并不真正影响对象的存储特性,如: typedef static int INT2;//不可行

编译将失败,会提示“指定了一个以上的存储类”。

以上资料出自:http://blog.sina.com.cn/s/blog_4826f7970100074k.html作者:赤龙 第三、typedef 与 #define的区别 案例一:

通常讲,typedef要比#define要好,特别是在有指针的场合。请看例子: typedef char *pStr1;#define pStr2 char *;pStr1 s1, s2;pStr2 s3, s4;

在上述的变量定义中,s1、s2、s3都被定义为char *,而s4则定义成了char,不是我们所预期的指针变量,根本原因就在于#define只是简单的字符串替换而typedef则是为一个类型起新名字。案例二:

下面的代码中编译器会报一个错误,你知道是哪个语句错了吗? typedef char * pStr;char string[4] = “abc”;const char *p1 = string;const pStr p2 = string;p1++;p2++;

是p2++出错了。这个问题再一次提醒我们:typedef和#define不同,它不是简单的文本替换。上述代码中const pStr p2并不等于const char * p2。const pStr p2和const long x本质上没有区别,都是对变量进行只读限制,只不过此处变量p2的数据类型是我们自己定义的而不是系统固有类型而已。因此,const pStr p2的含义是:限定数据类型为char *的变量p2为只读,因此p2++错误。第四部分资料:使用 typedef 抑制劣质代码 作者:Danny Kalev 编译:MTT 工作室

原文出处:Using typedef to Curb Miscreant Code

摘要:Typedef 声明有助于创建平台无关类型,甚至能隐藏复杂和难以理解的语法。不管怎样,使用 typedef 能为代码带来意想不到的好处,通过本文你可以学习用 typedef 避免缺欠,从而使代码更健壮。typedef 声明,简称 typedef,为现有类型创建一个新的名字。比如人们常常使用 typedef 来编写更美观和可读的代码。所谓美观,意指 typedef 能隐藏笨拙的语法构造以及平台相关的数据类型,从而增强可移植性和以及未来的可维护性。本文下面将竭尽全力来揭示 typedef 强大功能以及如何避免一些常见的陷阱。

Q:如何创建平台无关的数据类型,隐藏笨拙且难以理解的语法? A:使用 typedefs 为现有类型创建同义字。定义易于记忆的类型名

typedef 使用最多的地方是创建易于记忆的类型名,用它来归档程序员的意图。类型出现在所声明的变量名字中,位于 ''typedef'' 关键字右边。例如:

typedef int size;此声明定义了一个 int 的同义字,名字为 size。注意 typedef 并不创建新的类型。它仅仅为现有类型添加一个同义字。你可以在任何需要 int 的上下文中使用 size:

void measure(size * psz);size array[4];size len = file.getlength();std::vector vs;typedef 还可以掩饰符合类型,如指针和数组。例如,你不用象下面这样重复定义有 81 个字符元素的数组:

char line[81];char text[81];定义一个 typedef,每当要用到相同类型和大小的数组时,可以这样:

typedef char Line[81];Line text, secondline;getline(text);同样,可以象下面这样隐藏指针语法:

typedef char * pstr;int mystrcmp(pstr, pstr);这里将带我们到达第一个 typedef 陷阱。标准函数 strcmp()有两个„const char *‟类型的参数。因此,它可能会误导人们象下面这样声明 mystrcmp():

int mystrcmp(const pstr, const pstr);这是错误的,按照顺序,„const pstr‟被解释为„char * const‟(一个指向 char 的常量指针),而不是„const char *‟(指向常量 char 的指针)。这个问题很容易解决:

typedef const char * cpstr;int mystrcmp(cpstr, cpstr);// 现在是正确的 记住:不管什么时候,只要为指针声明 typedef,那么都要在最终的 typedef 名称中加一个 const,以使得该指针本身是常量,而不是对象。代码简化

上面讨论的 typedef 行为有点像 #define 宏,用其实际类型替代同义字。不同点是 typedef 在编译时被解释,因此让编译器来应付超越预处理器能力的文本替换。例如:

typedef int(*PF)(const char *, const char *);这个声明引入了 PF 类型作为函数指针的同义字,该函数有两个 const char * 类型的参数以及一个 int 类型的返回值。如果要使用下列形式的函数声明,那么上述这个 typedef 是不可或缺的:

PF Register(PF pf);Register()的参数是一个 PF 类型的回调函数,返回某个函数的地址,其署名与先前注册的名字相同。做一次深呼吸。下面我展示一下如果不用 typedef,我们是如何实现这个声明的:

int(*Register(int(*pf)(const char *, const char *)))(const char *, const char *);很少有程序员理解它是什么意思,更不用说这种费解的代码所带来的出错风险了。显然,这里使用 typedef 不是一种特权,而是一种必需。持怀疑态度的人可能会问:“OK,有人还会写这样的代码吗?”,快速浏览一下揭示signal()函数的头文件,一个有同样接口的函数。typedef 和存储类关键字(storage class specifier)

这种说法是不是有点令人惊讶,typedef 就像 auto,extern,mutable,static,和 register 一样,是一个存储类关键字。这并是说 typedef 会真正影响对象的存储特性;它只是说在语句构成上,typedef 声明看起来象 static,extern 等类型的变量声明。下面将带到第二个陷阱:

typedef register int FAST_COUNTER;// 错误

编译通不过。问题出在你不能在声明中有多个存储类关键字。因为符号 typedef 已经占据了存储类关键字的位置,在 typedef 声明中不能用 register(或任何其它存储类关键字)。促进跨平台开发

typedef 有另外一个重要的用途,那就是定义机器无关的类型,例如,你可以定义一个叫 REAL 的浮点类型,在目标机器上它可以i获得最高的精度:

typedef long double REAL;在不支持 long double 的机器上,该 typedef 看起来会是下面这样:

typedef double REAL;并且,在连 double 都不支持的机器上,该 typedef 看起来会是这样:、typedef float REAL;你不用对源代码做任何修改,便可以在每一种平台上编译这个使用 REAL 类型的应用程序。唯一要改的是 typedef 本身。在大多数情况下,甚至这个微小的变动完全都可以通过奇妙的条件编译来自动实现。不是吗? 标准库广泛地使用 typedef 来创建这样的平台无关类型:size_t,ptrdiff 和 fpos_t 就是其中的例子。此外,象 std::string 和 std::ofstream 这样的 typedef 还隐藏了长长的,难以理解的模板特化语法,例如:basic_string,allocator>和 basic_ofstream>。

第二篇:it用法小结

小结(2008-12-08 15:57:31)

标签:教育

It用法小结

it在英语语法中属人称代词,意思是“它”,用来指人以外的一切生物和事物。它的用法不仅不简单,而且很复杂。

一、用于指人以外的一切生物、无生命的东西和事情。

一般指说话者心目中已经了解或所指的生物、无生命的东西或事情、没有性别的区分;可以是可数名词,也可以是不可数名词,在句子中既可做主语,也可以作宾语。

1.指动物和植物。如:

—Oh,that's Lucy's hat.噢,那是露茜的帽子。

—It looks like a cat!它看上去像只猫!

Where's tea grown?It's grown in the southeast of China.

什么地方种植茶?中国东南部种植茶。

2.指代一些无生命的东西。如:

Is it your watch?这是你的手表吗?

Look at the rain!It's heavy,isn't it?看这雨!雨很大,对吗?

3.代替上文提到过的整个事情。如:

Well,you mustn't play on the road.It's dangerous.哦,你不能在公路上玩。这太危险了!It was hard work,but they really enjoyed it.摘苹果是艰苦活,可他们都乐意去干(它)。

二、用于指代人。

1.指代说话者心目中不太清楚的那个人,常在打电话或敲门时用。如:

—Who was it?是谁(打来的电话)?

—Was it Susan?(打电话的)是苏珊吗?

—Yes,it was.是的,我是。(根据上下句,“it was”也可不译出来。)

再如:—Who is knocking at the door?谁在敲门?

—It's me.是我。

2.指说话者心目中的那个人。如:

—Is it your sister,Kate?(那旧照片上的 baby)是你姐姐凯特吧?

—No!不是。

—Is it your brother?是你哥哥吧?

—No!不是。

—I know—it's you!我知道了,(那)是你。

3.指代性别不详的婴幼儿或在不计较性别时,也可用it来指人。如

The child smiled when it saw its mother.这小孩一见到母亲就笑了。

I don't know who it is.我不知道他是谁。

注意:看到这样的句子(或听到这样的话)时,要想一想,不要一看到it就把它译成“它”。)

4.在回答用指示代词表示人的特殊问句时,常用it指人。如:

—Who's that?那人是谁?

—Is it Kate?是凯特吗?

—Yes,I think you're right.It's Kate.是的,我想你说对了,是凯特。

三、用于指时间、距离和自然现象等。

1.表示时间。如:

—What time is it?几点钟?

—It's ten.十点钟。

It's summer in Australia now.现在澳大利亚是夏天。

特别注意it用于表示时间时还常见于以下两个句型中:

(1)It's time(for sb.)to do sth./It's time for sth.译为“是(某人)该干„„的时间了”、“到„„的时候了”。如:

It's time for supper/to have supper.是吃晚饭的时候了。

I think it's time for us to start the lesson now.我想现在是我们开始上课的时候了。

(2)It is /has been +时间段+since +一般过去时。译为“自从„„以来已过了„„(时间)”。此结构可以与另一种句型进行同义句转换。如:

It has been two weeks since we met last.= Two weeks has passed since we met last.自从我们上次相遇以来,两个星期过去了。

It's three years since he came here.=It has been three years since he came here.=He has been here for three years.他到这里已经三年了。

2.表示距离。如:

It's half an hour's walk from my home to the school.从我家到学校步行得花半小时时间。—Where's the farm,Li Lei?Is it far?李雷,农场在哪里?远吗?

—No,it's quite near.不,(距)离这很近。

3.表示自然现象。如:

Sometimes it snows and the land is all white.有时下雪,大地一片白。

It is very quiet here at the moment.眼下这儿很安静。

四、用作形式主语。

英语中常常见到某个句子以it开头,it与其后面的动词不定式短语、动名词短语、名词性从句等相呼应,以表达一个完整的意义。这是一种习惯表达法,这样的句式可避免句子显得头重脚轻。

1.It+is/was+形容词+(for/of sb.)+动词不定式短语。对于这个句型中究竟用 for还是用of,一般遵循这样的规则:如果形容词仅仅是描述事物的形容词,如:difficult,easy,hard,important,dangerous等用for;如果形容词是描述不定式行为者的性格、品质的,如:kind,good,nice,clever等则用of。如:

It is interesting to play with snow in winter.冬季里玩雪是很有趣的。

It's important for us to keep the water clean.保持水质清洁对我们来说是很重要的。It's very kind of you to say so.你这样说真是太好了。

注意:这一句式中的形容词位置也可换用名词;连系动词be也可换用其它连系动词,如feel等。如:

It's a good habit to get up early and go to bed early.早睡早起是好习惯。

It must be great fun to fly to the moon in a spaceship.乘宇宙飞船飞往月球一定很有趣。It feels strange to have a twin sister.有个孪生姐妹感觉很奇怪。

2.It +will be/is /was +形容词+动名词短语。如:

It's bad playing in the street.在街上玩是没好处的。

Is it any good trying again?再试一次有用吗?

3.It+is/was+形容词+从句。如:

It is certain that he will come.他一定会来。

It's true that he may fall behind the other students.他真的可能落后于其他同学。

It is strange that he should say so.他居然这么说,真是奇怪。

4.It +is /was +one's turn(duty,pleasure)+to do sth.意为“该轮到某人做某事(做某事是某人的责任、愉悦的事)”。如:

It's your turn to be on duty tomorrow.明天轮到你值日了。

5.It takes(sb.)some time to do sth.意为“(某人)花„„时间做某事”。如

It took me a week to finish reading the book.我花了一周时间看完这本书。

6.It +cost/costs +sb.+some money +to do sth.译为“某人花多少钱做某事”。如:It cost me 260 yuan to buy the new watch.我买这块新手表花了260元。

7.It seems /seemed +从句。译为“看起来好像„„”,此结构可以转换成“seem +动词不定式”形式。如:

It seems that he is ill.=He seems to be ill.看起来他好像病了。

[原题再现]

①________is a fact that English is being accepted as an international language.A.ThereB.ThisC.ThatD.It

② In fact________ is a hard job for the police to keep order in an important football match.A.thisB.thatC.thereD.it

答案: ① D ② D

五、用作形式宾语。

当句子的真正宾语是动词不定式、动名词或从句时,为避免句子头重脚轻,须将其放在宾语补足语之后,改用先行词it占据其原来的位置。it用作形式宾语的句型为:主语+谓语+it+宾语补足语+动词不定式/动名词/从句。该句型中宾语补足语可由形容词、名词等充当。如:

He found it not easy to learn a foreign language well.他发现学好一门外语是不容易的。We think it no good reading in bed.我们认为躺在床上看书无益处。

I think it necessary that we have the meeting.我认为开这个会是必要的。

[原题再现]

Don't ________that all those who get good grades in the entrance examination will prove to be most successful.A.take as grantedB.take this for granted

C.take that for grantedD.take it for granted

答案: D

六.构成强调句。

如:

It was in the street that I saw Li Ping this morning.今天早晨,就是在街上我看见李明。

[原题再现]

________was in 1979________I graduated from university.A.That;that B.It;that C.That;when D.It;when

答案: B

七.构成特殊句式。如:

It seems as if we should finish it tomorrow.【练习】

(1)There is a photo on the wall.____ the photo of Lei Feng.A.It B.Its C.It's D.He(高考,1980)

(2)Is_necessary to tell his father everything?

A.it B.that C.what D.he(MET1987)

(3)Is_possible to fly to the moon in a spaceship?

A.now B.man C.that D.it

(4)I consider____ my duty to help you.

A.it B.this C.that D.its

(5).It was at four o'clock in the afternoon ____ he and his grandpa reached the museum in Guanghan.A.while B.that C.when D.as

答案:(1)C(2)A(3)D(4)A(5)B

(6).I like ____ in the autumn when the weather is clear and bright.(2004全国I)

A.this B.that C.it D.one

(7).-Do you like ___ here?

-Oh,yes.The air,the weather,the way of life.Everything is so nice.(2004全国II)

A.this B.these C.that D.it

(8).The Parkers bought a new house but ____ will need a lot of work before they can move in.A.they B.it C.one D.which

(9).I hate___ when people talk with their mouths full.A.it B.that C.these D.them

(10).Joan had often heard____ said that Marley had no money.A.it B.this C.that D.one

答案:C D B A A

八、it, one和that作替代词的用法及区别

it, one和that虽然都可以用来替代前面所提到的一个单数名词,以避免重复,但在具体用法上却有不同。简述如下:

1.it代替前面提到的同一事物,该事物既可以是可数名词也可以是不可数名词。

[原题再现]

The news that they failed their driving test discouraged him, ______?

A.did theyB.didn't theyC.did itD.didn't it

答案: D

2.one代替前面提到的同类事物中的一个。该事物只能是可数名词,前面可以有冠词,也可以被this、that或形容词修饰,其后也可以有定语。

[原题再现]

-Why don't we have a little break?

-Didn't we just have________?

A.it B.that C.one D.this

答案: C

3.that代替前面提到的同类事物中特指的一个。该事物既可以是可数名词也可以是不可数名

词,要有后置定语,但不可以有前置修饰语。

[原题再现]

Few pleasures can equal ________ of a cool drink on a hot day.A.someB.anyC.thatD.those

答案: C

高考“it”的用法英语题

历届高考英语单项选择题精选

(一)“it”的用法

1.Was it during the Second World War_____ he died?

A.thatB.while

C.in whichD.then(88)

2.Is ____ necessary to complete the design before National Day?

A.thisB.that

C.itD.he(89)

3.I don

t think ____ possible to master a foreign language without much memory work.A.thisB.that

C.itsD.it(91)

4.Does ______ matter if he can’t finish the job on time?

A.thisB.that

C.heD.it(91)

5.It was not _____ she took off her glasses _____ I realized she was a famous film star.A.when , thatB.until , that

C.until , thatD.when , then(92)

6.I was disappointed with the film.I had expected ______ to be much better.A.thatB.this

C.oneD.it(93)

7.It was not until 1920 ______ regular radio broadcasts began.A.whileB.which

C.thatD.since(94)

8.______is a fact that English is being accepted as an international language.A.ThereB.This

C.ThatD.It(95)

9.It was only when I reread this poems recently _____ I began to appreciate their beauty.A.untilB.that

C.thenD.so(97)

10.I hate _____ when people talk with their mouths full.A.itB.that

C.theseD.them(98)

11.It is the ability to do the job _____ matters not where you come from or what you are.A.oneB.that

C.whatD.it(2000)

KEYS:1-5 ACDDB6-10 DCDBA11 B ’

第三篇:it用法小结

小结(2008-12-08 15:57:31)

标签:教育

It用法小结

it在英语语法中属人称代词,意思是“它”,用来指人以外的一切生物和事物。它的用法不仅不简单,而且很复杂。

一、用于指人以外的一切生物、无生命的东西和事情。

一般指说话者心目中已经了解或所指的生物、无生命的东西或事情、没有性别的区分;可以是可数名词,也可以是不可数名词,在句子中既可做主语,也可以作宾语。1.指动物和植物。如:

—Oh,that's Lucy's hat.噢,那是露茜的帽子。

—It looks like a cat!它看上去像只猫!

Where's tea grown?It's grown in the southeast of China.

什么地方种植茶?中国东南部种植茶。2.指代一些无生命的东西。如: Is it your watch?这是你的手表吗?

Look at the rain!It's heavy,isn't it?看这雨!雨很大,对吗? 3.代替上文提到过的整个事情。如:

Well,you mustn't play on the road.It's dangerous.哦,你不能在公路上玩。这太危险了!It was hard work,but they really enjoyed it.摘苹果是艰苦活,可他们都乐意去干(它)。

二、用于指代人。

1.指代说话者心目中不太清楚的那个人,常在打电话或敲门时用。如:

—Who was it?是谁(打来的电话)? —Was it Susan?(打电话的)是苏珊吗?

—Yes,it was.是的,我是。(根据上下句,“it was”也可不译出来。)再如:—Who is knocking at the door?谁在敲门?

—It's me.是我。

2.指说话者心目中的那个人。如:

—Is it your sister,Kate?(那旧照片上的 baby)是你姐姐凯特吧?

—No!不是。

—Is it your brother?是你哥哥吧?

—No!不是。

—I know—it's you!我知道了,(那)是你。

3.指代性别不详的婴幼儿或在不计较性别时,也可用it来指人。如 The child smiled when it saw its mother.这小孩一见到母亲就笑了。I don't know who it is.我不知道他是谁。注意:看到这样的句子(或听到这样的话)时,要想一想,不要一看到it就把它译成“它”。)4.在回答用指示代词表示人的特殊问句时,常用it指人。如:

—Who's that?那人是谁?

—Is it Kate?是凯特吗?

—Yes,I think you're right.It's Kate.是的,我想你说对了,是凯特。

三、用于指时间、距离和自然现象等。1.表示时间。如:

—What time is it?几点钟?

—It's ten.十点钟。

It's summer in Australia now.现在澳大利亚是夏天。特别注意it用于表示时间时还常见于以下两个句型中:(1)It's time(for sb.)to do sth./It's time for sth.译为“是(某人)该干„„的时间了”、“到„„的时候了”。如:

It's time for supper/to have supper.是吃晚饭的时候了。

I think it's time for us to start the lesson now.我想现在是我们开始上课的时候了。

(2)It is /has been +时间段+since +一般过去时。译为“自从„„以来已过了„„(时间)”。此结构可以与另一种句型进行同义句转换。如:

It has been two weeks since we met last.= Two weeks has passed since we met last.自从我们上次相遇以来,两个星期过去了。

It's three years since he came here.=It has been three years since he came here.=He has been here for three years.他到这里已经三年了。2.表示距离。如:

It's half an hour's walk from my home to the school.从我家到学校步行得花半小时时间。

—Where's the farm,Li Lei?Is it far?李雷,农场在哪里?远吗?

—No,it's quite near.不,(距)离这很近。3.表示自然现象。如:

Sometimes it snows and the land is all white.有时下雪,大地一片白。It is very quiet here at the moment.眼下这儿很安静。

四、用作形式主语。

英语中常常见到某个句子以it开头,it与其后面的动词不定式短语、动名词短语、名词性从句等相呼应,以表达一个完整的意义。这是一种习惯表达法,这样的句式可避免句子显得头重脚轻。

1.It+is/was+形容词+(for/of sb.)+动词不定式短语。对于这个句型中究竟用 for还是用of,一般遵循这样的规则:如果形容词仅仅是描述事物的形容词,如:difficult,easy,hard,important,dangerous等用for;如果形容词是描述不定式行为者的性格、品质的,如:kind,good,nice,clever等则用of。如:

It is interesting to play with snow in winter. 冬季里玩雪是很有趣的。

It's important for us to keep the water clean.保持水质清洁对我们来说是很重要的。It's very kind of you to say so.你这样说真是太好了。注意:这一句式中的形容词位置也可换用名词;连系动词be也可换用其它连系动词,如feel等。如:

It's a good habit to get up early and go to bed early.早睡早起是好习惯。

It must be great fun to fly to the moon in a spaceship.乘宇宙飞船飞往月球一定很有趣。It feels strange to have a twin sister.有个孪生姐妹感觉很奇怪。2.It +will be/is /was +形容词+动名词短语。如: It's bad playing in the street.在街上玩是没好处的。Is it any good trying again?再试一次有用吗? 3.It+is/was+形容词+从句。如:

It is certain that he will come.他一定会来。It's true that he may fall behind the other students.他真的可能落后于其他同学。It is strange that he should say so.他居然这么说,真是奇怪。

4.It +is /was +one's turn(duty,pleasure)+to do sth.意为“该轮到某人做某事(做某事是某人的责任、愉悦的事)”。如:

It's your turn to be on duty tomorrow.明天轮到你值日了。5.It takes(sb.)some time to do sth.意为“(某人)花„„时间做某事”。如 It took me a week to finish reading the book.我花了一周时间看完这本书。

6.It +cost/costs +sb.+some money +to do sth.译为“某人花多少钱做某事”。如: It cost me 260 yuan to buy the new watch.我买这块新手表花了260元。7.It seems /seemed +从句。译为“看起来好像„„”,此结构可以转换成“seem +动词不定式”形式。如:

It seems that he is ill.=He seems to be ill.看起来他好像病了。

[原题再现] ①________is a fact that English is being accepted as an international language.A.There B.This C.That D.It ② In fact________ is a hard job for the police to keep order in an important football match.A.this B.that C.there D.it 答案: ① D ② D

五、用作形式宾语。

当句子的真正宾语是动词不定式、动名词或从句时,为避免句子头重脚轻,须将其放在宾语补足语之后,改用先行词it占据其原来的位置。it用作形式宾语的句型为:主语+谓语+it+宾语补足语+动词不定式/动名词/从句。该句型中宾语补足语可由形容词、名词等充当。如:

He found it not easy to learn a foreign language well.他发现学好一门外语是不容易的。We think it no good reading in bed.我们认为躺在床上看书无益处。I think it necessary that we have the meeting.我认为开这个会是必要的。[原题再现] Don't ________that all those who get good grades in the entrance examination will prove to be most successful.A.take as granted

B.take this for granted C.take that for granted

D.take it for granted 答案: D

六.构成强调句。如:

It was in the street that I saw Li Ping this morning.今天早晨,就是在街上我看见李明。[原题再现] ________was in 1979________I graduated from university.A.That;that B.It;that C.That;when D.It;when 答案: B 七.构成特殊句式。如:

It seems as if we should finish it tomorrow.【练习】

(1)There is a photo on the wall.____ the photo of Lei Feng.A.It B.Its C.It's D.He(高考,1980)(2)Is_necessary to tell his father everything? A.it B.that C.what D.he(MET1987)(3)Is_possible to fly to the moon in a spaceship? A.now B.man C.that D.it(4)I consider____ my duty to help you. A.it B.this C.that D.its(5).It was at four o'clock in the afternoon ____ he and his grandpa reached the museum in Guanghan.A.while B.that C.when D.as 答案:(1)C(2)A(3)D(4)A(5)B(6).I like ____ in the autumn when the weather is clear and bright.(2004全国I)A.this B.that C.it D.one(7).-Do you like ___ here?-Oh,yes.The air,the weather,the way of life.Everything is so nice.(2004全国II)A.this B.these C.that D.it(8).The Parkers bought a new house but ____ will need a lot of work before they can move in.A.they B.it C.one D.which(9).I hate___ when people talk with their mouths full.A.it B.that C.these D.them(10).Joan had often heard____ said that Marley had no money.A.it B.this C.that D.one 答案:C D B A A

八、it, one和that作替代词的用法及区别

it, one和that虽然都可以用来替代前面所提到的一个单数名词,以避免重复,但在具体用法上却有不同。简述如下: 1.it代替前面提到的同一事物,该事物既可以是可数名词也可以是不可数名词。[原题再现] The news that they failed their driving test discouraged him, ______? A.did they B.didn't they C.did it D.didn't it 答案: D 2.one代替前面提到的同类事物中的一个。该事物只能是可数名词,前面可以有冠词,也可以被this、that或形容词修饰,其后也可以有定语。[原题再现]-Why don't we have a little break?-Didn't we just have________? A.it B.that C.one D.this 答案: C 3.that代替前面提到的同类事物中特指的一个。该事物既可以是可数名词也可以是不可数名词,要有后置定语,但不可以有前置修饰语。[原题再现] Few pleasures can equal ________ of a cool drink on a hot day.A.some B.any C.that D.those 答案: C

高考“it”的用法英语题

历届高考英语单项选择题精选

(一)“it”的用法

1.Was it during the Second World War_____ he died?

A.that

B.while

C.in which

D.then

(88)2.Is ____ necessary to complete the design before National Day? A.this

B.that

C.it

D.he

(89)3.I dont think ____ possible to master a foreign language without much memory work.A.this

B.that

C.its

D.it

(91)4.Does ______ matter if he can’t finish the job on time? A.this

B.that

C.he

D.it

(91)5.It was not _____ she took off her glasses _____ I realized she was a famous film star.A.when , that B.until , that C.until , that D.when , then

(92)6.I was disappointed with the film.I had expected ______ to be much better.A.that

B.this

C.one

D.it

(93)7.It was not until 1920 ______ regular radio broadcasts began.A.while

B.which

C.that

D.since

(94)8.______is a fact that English is being accepted as an international language.A.There

B.This

C.That

D.It

(95)9.It was only when I reread this poems recently _____ I began to appreciate their beauty.A.until

B.that

C.then

D.so

(97)10.I hate _____ when people talk with their mouths full.A.it

B.that

C.these D.them

(98)11.It is the ability to do the job _____ matters not where you come from or what you are.A.one

B.that

C.what

D.it

(2000)KEYS: 1-5 ACDDB 6-10 DCDBA 11 B

第四篇:there be 用法小结

there be 用法小结

1.基本结构

There be + 主语 + 地点/ 时间状语。如:

There is a computer in the room.房间里有一台电脑。

There are two TV plays every evening.每晚有两场电视剧。2.主谓一致

要采取就近一致原则,和靠近be 的主语一致。如:

There is a pen, two rulers in the box.盒子里有一只钢笔,两把尺子。

There are two boys and a teacher at the school gate.门口有两个男孩,一个老师。3.主语后的动词形式

在there be 句型中,主语与动词是主动关系时用现在分词;是被动关系时用过去分词。如:

There is a purse lying on the ground.地上有一个钱包。

There are five minutes left now.现在还有5分钟。4.反意疑问句。

反意疑问句应与 there be 对应,而不是依据主语。如:

There is a radio on the table, isn't there? 桌子上有一台收音机,是吧?

There are more than fifty classes in your school, aren't there? 你们班有50多名学生,是吧?

5.there be 与 have 的替换

there be 表示所属时可与 have 替换。

There is nothing but a book in my bag.= I have nothing but a book in my bag.包里只有一本书。

6.there be 后接不定式时常用主动形式表示被动意义。如:

There is a lot of work to do.有许多工作要做。

注意:当该句型主语是 something, anything, nothing 等不定代词时,后面的不定式用主动形式或被动形式,意义各不同。

There is nothing to do.没有事可做。

There is nothing to be done.没有办法(束手无策)。7.与其它词连用,构成复合谓语。如:

There may be a rain this afternoon.今天下午可能有雨。

There used to be a cinema here before the war.战争之前,这儿有一家电影院。8.变体

there be 结构中的 be 有时可用 live, stand, remain 等代替。如:

Once there lived a king who cared more about new clothes than anything else.从前有位国王喜欢新服胜过别的任何东西。

9.习惯用语

There is no good /use(in)doing sth.做某事没有好处/用处; There is not a moment to lose.一刻也不能耽误。例如:

There is no good making friends with him.和他交朋友没有什么好处。

He is very ill.Send him to hospital.There's not a moment to lose.他病得厉害,把他送到医院去,一刻也不能耽误。

There be表示存在的“有”,他有各种时态,如: 一般现在时:there is/are;一般过去时:therewas/were 一般将来时:there will be;过去将来时:there would be; 现在完成时:there has/have been;过去完成时:there had been 要特别注意be going to 在there be 句型中的运用。例如:

There is going to be a film in the meeting hall.学校礼堂里将有一场电影。还可扩展为许多其它句型,下面笔者对There be句型的扩展作一归纳。一There be+主语

这种句式表示事物的客观存在,There be放在句首,而把真正的主语放在后面,可以用来表示现在时、过去时、完成时和将来时。例如: There is a boy on the playground.操场上有个男孩。There has been a lot of rain this month.这个月雨水很多。There will be an announcement soon.不久会发布告。

二,There are + n(复数名词/不可数名词)+ and + n(复数名词/不可数名词)该句型表示同一类人或物的不同性质,尤其表示有好坏优劣之分,意为“有各种各样的”、“种种不一”等。如:

There are friends and friends.朋友有种种,有益友,有损友。There is tea and tea.茶叶有好有差。三 There be+名词+分词

这种句式中分词可以是现在分词,也可以是过去分词。doing表示动作和前面名词有主谓关系,过去分词done和前面名词有被动关系。如: There is a man sitting on the fence.有个人正坐在篱笆上。There was a car stolen last night.昨晚有辆车被偷了。这种句式可以用“主语+be+分词”这一结构来代替。例如: There is a boy playing with a puppy in the yard.(= A boy is playing witha puppy in the yard.)一个男孩正在院子里和一只小狗玩耍。

There has been more money spent on armaments than on famine relief.(=More money has been spent on armaments than on famine relief.)花在军备上的钱比花在救灾上的钱还多。四,There be+名词+动词不定式

这种句式中的及物动词(动词不定式)也可改成被动式, 意为“(没)有……要做”。例如: There is a lot of work to do(to be done).有许多工作要做。There was no time to wait for you.没有时间再等你了。

注意:There is nothing to do与There is nothing to be done.含义不同。前者意为:“无事可做”,后者意为“没有办法”。试比较: There is nothing to do-I'm bored.无事可做--我感到闷得慌。(=There is nothing to entertain me.)没有什么活动来消遣。

There is nothing to be done-we'll have to buy another one.没有办法--我们只好另外买一个了。(= There is no way off putting it right.)五 There is+no+动名词

这种句式可与“It is impossible+动词不定式”替换,意为“无法做某事”。例如: There is no stopping him.(=It is impossible to stop him.)无法阻止他。There is no guessing what will happen.无法猜到将会发生什么。六,There is(no)need for+名词 该句式意为“(不)需要……”。例如: There is no need for anxiety.不需要担心。

There is a great need for a book on this subject.非常需要有一本关于这个题目的书。

七,There is no need+动词不定式.例如: There is no need for him to come.不需要他来了。

There is no need(for you)to start yet.(你)现在还没有必要动身。八,There is no use+动名词

该句式可与“It is no use+动名词”互换,意为“……无用(无济于事)”。例如: There is no use waiting any longer.(=It is no use waiting any longer.)再等下去是没有用的。

There is no use(in)offering the olive branch now.现在想和解也无济于事了。九,There is nothing / not anything like… 该句型中“nothing/ not anything like…”相当于“nothing / not anything better / more suitable than…”,意为“没有什么比……更好/更合适/更有效了”。如:

There is nothing like a book for taking you out of yourself.没有什么比书更能使你解脱自己了。There is nothing like walking as a means of keeping fit.作为保持健康的方法,没有什么比散步更好的了。十,There is nothing more...than 该句式意为“再……不过了”。例如: There is nothing more dangerous than an illusion of security.太平无事的想法是再危险不过的了。

十一,There is no(not any)point in+动名词 该句式意为:“……是没有意义(思)的。”例如: There is no point in doing so.这样做是没有意义的。

There is not any point in harping on the same old tune.没有必要再重复这一套。十二,情态动词及ought to,have to,used to用在there be结构中。例如: There must be something wrong with the machine,for it doesn’t run well.机器一定出了毛病,因为他运转不正常。

There oughtn’t to be too great a difference in our views.我们的看法不应该存在太大的分歧。

There might be some good songs after all this trash.在播放了这些乱七八糟的歌曲之后,可能会放几首好歌。

If the power hadn't been cut off so quickly, there could have been a big fire.要不是迅速切断电源,可能会引发一场大火。十三,There is a possibility of(或that)该句式表示“有可能”。例如: There is a possibility of my going to Denmark.(= There is a possibility that I may be able to go to Denmark.)我有可能去丹麦。十四, There+人称代词+come(go)/there come(go)+名词

该句式是there作感叹词放在句首。如果主语是人称代词,则动词放在其后;如果主语是名词,则动词放在其前。例如: There they come!他们来了!There comes the bus at last!公共汽车终于来啦!十五,.There+动词 这种句式只限于表示存在某种状态、发生某种事或某事、某人到达等动词,意义比there be 结构格更为生动贴切。如live,lie seem,appear,happen tand,exist,arise,enter,come,go,remain,exist,rise,occur,flow,arrive,enter,follow等。而不适用于表示一般具体行动的动词。例如: Many years ago,there lived an emperor who cared more for clothes than for anything else.许多年前有位皇帝热衷于漂亮的衣服胜过其他东西。There stands a tall building across the river over there.河对面耸立着一幢高层建筑物。There goes the bell.铃响了。

There comes a knock at the door.有人敲门。

There remains one question to be discussed.还剩一个问题要讨论。There seems to be something wrong about it.这事好像有点儿不大对头。There appears to be no one who can answer this question.看来没人能够回答这个问题。

There will follow an interval of five minutes.随后将有五分钟的休息。

十六,There are/is certain(sure,likely)to be该结构的意义为肯定有/可能有。例如:

Thereare like to be more difficulties than you were prepared for。很可能会遇到你预想不到的困难。There are sure to be a restaurant some where。某处肯定有个饭店。十七,There +be+ed分词+to be常用动词有:say,expect,believe,consider,think,mean,构成信息来源模糊表达式。例如: There is/are said to be a number of wounded on both sides。据说双方都有不少受伤。

There is/are expected to be an exciting film next week。预计下周有一步精彩电影上演。

十八v + there to be该结构中的动词往往是:expect, want, intend, mean, consider, like, hate, prefer等接不定式做宾语的动词。如:

We don’t want there to be any students falling behind.我们不想有任何学生落后。

I should prefer there tobe no disscusion。我希望没有讨论。动词let后接there be 做宾语补足语。如: Let there be no mis under standing。不要产生误会。

十九There being/having been是独立主格结构,在句中作状语。如: There having been no rain for a long time, the ground was burned black by the sun.好长时间未下雨,大地都给太阳烤焦了。

二十There(not)being/there(not)having been用作ing分词的复合结构在句中做主语或宾语。例如:

There being a bus stop so near the house is an advantage。(做主语)公共汽车站离家这末近是一很有利的条件。I dreamed of there being a holiday tomorrow。我梦想明天有一假日。二十一,for ther to be 为不定式复合结构例如: For there to be no late comers was unusual。没人迟到这是不寻常的事。

It is not cold enough for there to be frost。天还不够冷不足以有霜冻。

二十二,There is nothing for it but to do sth 该句型相当于“There is no choice but to do sth”,意为“别无他法,只能……”。如:

There is nothing for it but to do what is required.只能按要求去做了,别无他法。(=I have no choice but to do what it required.)

第五篇:IT用法小结

It用法小结

王婷婷

It的用法复杂多变,现对it的用法小结一下。

1.It 用作人称代词:It可用代词,作人称代词,指前面已经提到过的事物,动物或人,在句中作主语或宾语.

例如:1).He bought a dictionary and gave it to me.(指代物品the dictionary)2).Don’t think any more about it.(指代事件)3).---Who is that ?---It’s me.Open the door, please.(指代人)

2.It 用作非人称代词:It 也用作非人称代词,常常用作句子主语,表示天气,日期,时间,温度,距离等.

1).It was raining when I left the office.(表示天气)2).It is February 14th today.(表示日期)3).It is an hour’s walk from my home to the school.(表示距离)IT在表示时间时要注意以下的一些句式:

① It be … since...该句型主句中的 it 指时间,主句中是时间作表语,其时态是现在时或完成时,since 引导的从句通常是一般过去时态。如果主句是一般过去时,从句则用过去完成时。

It is(has been)5 years since his father died.It was 5 years since I had enjoyed myself so much.It is(has been)5 years since I smoked.②It be...when...该句型中的 when 引导的是一个时间状语从句,主句中的 it 指时间,表语由具体的时间充当。常译为“当……的时候,是……”。

It was 5 o'clock when he came here.③It be...before...该句型主句中的 it 指时间, 主句中的时态常是将来一般时或过去时两种时态.主句中的表语多是long, not long , 3 days , 2 weeks 等表示时间段的词或短语。常译为“……之后……”“过多久....才...”。

It was 3 days before he went to Beijing.It will be not long before he finishes his job.④It is time(about time , high time)that...该句型中that 后的从句应该用虚拟语气,① 常用过去时态表示虚拟.② 有时也用should + 动词原形,should 不能省。常译为“是(正是)……的时侯……”。

It is time that children should go to bed.= It is time that children went to bed.⑤It is the first(second …)time that …该句型要和上一个句型区别开来。该句型中的 that 从句不用虚拟语气,而用完成时态。至于用什么完成时态,由主句的谓语动词的时态决定。如果是一般现在时,后面从句用现在完成时态;如果是一般过去时,后面从句则用过去完成时态。该结构中 that 可以省去;it 有时用 this 替换,常译为“是第一

(二)……次……”。

It is the first time I have been here.= This is the first time I have been here.3.It作形式主语

替代作主语的从句、动词不定式、动名词,为避免“头重脚轻”,而把真正作主语的从句、动词不定式、动名词置于句尾。

It 作形式主语的常见句型:

1).替代作主语的动词不定式,其句型为

It be adj.(for∕of sb.)to do sth.常见的形容词有:

important, necessary, natural ,easy, safe, common, normal, hard, difficult, dangerous, unusual, impossible, pleasant,foolish,clever,brave,kind,wise 等。

It takes sb.sometime to do sth.2)

替代作主语的动名词的常见句型:

It’s no good/ no use / useless doing… 3).替代作主语的从句常见句型

①It is + noun(a pity, a shame, no wonder)+从句

②.It is adj.+clause ③It is v-ed that…=sb/sth is to do

(verb=say, report, think, believe, hope, expect, agree, accept, decide, determine, intend, plan, understand, know,suggest,demand,request,order等)如果为表示命令,建议,要求的词,则从句要用虚拟语气,及shoule+v.(should可省)

④It verb(to sb.)that…= sb/sth verb to do(verb = appear, seem, happen, occur, turn out 等)

⑤It verb sb.+ clause= It is v-ing + clause

It+surprise/delight/interest/disappoint/worry/disturb/annoy/amaze/bother/concern/frighten/please/anger sb.that…

4.It作形式宾语

当不定式、动名词、that 从句作宾语,又有自己的宾语补语时,要用it 作形式宾语,而把真正的宾语后置。能够用于形式宾语句型的动词有think, make, find, consider, feel, take,suppose,keep等。如:

Marx found it important to study the situation in Russia.The fisherman made it a rule that he never cast his net more than four times a day.We think it necessary reading aloud every morning to improve our English.以下的动词在接宾语从句时需要先加it再接从句:hate,like,dislike,love,appreciate,enjoy,prefer等。

eg.I would appreciate it if you would like to teach me how to use the computer.I hate it when people talk with their mouths full.I like it in the autumn when the weather is clear and bright.5.It 用在强调句型中

①It is + 被强调部分 + that...该句型是强调句型。将被强调的部分放在前面,其它部分置于that 之后。被强调部分可以是主语,宾语,或状语。强调的对象是人时,可用who, whom, that,其余情况一律用 that;当强调对象在从句中做主语时用who, that,当强调对象在从句中作宾语时用whom ,that如果把这种句型结构划掉后,应该是一个完整无缺的句子。这也是判断强调句型与其它从句的方法。

It was about 600 years ago that the first clock with a face and an hour hand was made.It was they that(who)cleaned the classroom yesterday.It was in the street that I met her father.②.强调对象是疑问词

Why is it that you want to leave so soon? ③.It is not until + 被强调部分 + that...该句型也是强调句型。主要用于强凋时间状语,译成汉语 “直到……才……”,可以说是 not...until...的强调形式。

It was not until she took off her dark glasses that I realized she was a famous film star.= Not until she took off her dark glasses did I realize she was a famous film star.= I didn't realize she was a famous film star until she took off her dark glasses.

下载C++ typedef用法小结word格式文档
下载C++ typedef用法小结.doc
将本文档下载到自己电脑,方便修改和收藏,请勿使用迅雷等下载。
点此处下载文档

文档为doc格式


声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:645879355@qq.com 进行举报,并提供相关证据,工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。

相关范文推荐

    with用法小结[★]

    with用法小结 一、with表拥有某物 Mary married a man with a lot of money . 马莉嫁给了一个有着很多钱的男人。 I often dream of a big house with a nice garden . 我......

    with用法小结

    with用法小结 一、with表拥有某物 I often dream of a big house with a nice garden. 我经常梦想有一个带花园的大房子。 二、with表用某种工具或手段 Tom drew the pictur......

    as用法小结

    as虽小,功能强大 as是英语中意义广泛、用法灵活且复现率极高的词, 每年高考命题和其他各级命题都会从不同角度对其进行考查。它在词性上有介词、连词和代词等,主要有以下用法......

    with用法小结

    with用法小结 一、with表拥有某物 1、Mary married a man with a lot of money . 马莉嫁给了一个有着很多钱的男人。 2、I often dream of a big house with a nice garden......

    with用法小结

    with用法小结 一、with表拥有某物 Mary married a man with a lot of money . 马莉嫁给了一个有着很多钱的男人。 I often dream of a big house with a nice garden. 我经......

    一般将来时用法小结

    一般将来时用法小结 一般将来时表示在将来某个时间要发生的动作或存在的状态。 一 . 一般将来时的构成: 1. 由助动词“ shall/ will +动词原形”构成, shall 用于第一人称, wi......

    find用法小结

    =============================== 1. 通过文件的特征查找: =============================== 1) 按文件名 find / -name httpd.conf find /usr -name httpd.conf fin......

    英语教案-with用法小结

    英语教案-with用法小结英语学习者在学习过程中,常会遇到with这个介词,而这个词在不同的语言环境中,其含义不近相同,经常让你无从下手,这里笔者对with用法做一小结,以供读者参考。......