What does 'Language Construct' mean?

2019-01-22 18:48发布

I am learning C from 'Programming in C' by Stephen Kochan.

Though the author is careful from the beginning only not to confuse the students with jargon, but occasionally he has used few terms without explaining their meaning. I have figured out the meaning of many such terms with the help of internet.

However, I could not understand the exactly meaning of the phrase 'language construct', and unfortunately the web doesn't provide a good explanation.

Considering I am a beginner, what does 'language construct' mean?

标签: terminology
8条回答
爷的心禁止访问
2楼-- · 2019-01-22 19:18

A language construct is a piece of language syntax. For example, the following is a language construct in C that lets you control the flow of a program:

if ( condition ) {
  /* when condition is true */
} else {
  /* when condition is false */
}

They usually use the term language construct because these are parts of most programming languages, but may be written differently, depending on the language. For example, a similar language construct in bourne shell would be:

if COMMAND; then
  # when command returns 0
else
  # when command returns anything else
fi

The function of this construct is the same, however, the way it's written is a bit different.

Hope this helps. If you need more detail, you may want to do a bit more research. As one of the comments suggests, Wikipedia may be helpful.

查看更多
一夜七次
3楼-- · 2019-01-22 19:23

Let say you want to create a class containing methods and properties, so:

Construct is an architecture of a class you are about to create. The architecture of the class consists of methods and properties created by you by using predefined utilities (such as: 'if', 'else', 'switch', 'break', etc)

That's my take on construct.

查看更多
登录 后发表回答