0

Note the text below is technical (programming).

The function main shall not be used within a program. The linkage (3.5) of main is implementation-defined. A program that defines main as deleted or that declares main to be inline, static, or constexpr is ill-formed. The name main is not otherwise reserved. [ Example: member functions, classes, and enumerations can be called main, as can entities in other namespaces. — end example ]

I'm trying to understand meaning of highlited sentence. Can I mention it as

there is no more restrictions applied to the main, except are noted above.

UPD:

I will have cited the definition in my understanding.

function::= is a block of instruction to be executed.

main function::= It can be mention as abstract function at the point of previous definition.

linkage::= I can cite a definition of this concept, but it contains terms which are required a definition themselves.

inline, static, constexp::= modifiers which can be applied to any function.

member function, classes, etc::= Entities of the programming languages which I'm considering. It can be mentioned as "building blocks" of a program.

Also, I think that there is no need to provide a definition of program. :)

  • What language it this? – ʇolɐǝz ǝɥʇ qoq Jun 27 '14 at 18:26
  • @Bobthezealot It is c++. More precisely, it is c++ N3797 working draft, section. 3.6.1/2. – Dmitrii Bundin Jun 27 '14 at 18:27
  • Although the context is obvious to someone familiar with the topic, please make sure to include that information in your question. Technical terms can be rather context-specific, and "technical (programming)" may not be enough information. – snailboat Jun 27 '14 at 18:32
  • @snailplane I'm sorry. Can you see my updated answer? – Dmitrii Bundin Jun 27 '14 at 18:44
1

I'm not exactly sure what your interpretation is trying to say. You are correct to say that there are no restrictions on "main" other than the ones noted earlier.

However, in the context of a programming language, "reserved word" has a specific meaning. If a word is reserved, it can't be used as a name for anything. I believe this is saying that within the specified programming language, it is legal to use the word "main" as the name for things that are not functions. So, as your examples say, you are allowed to use the word "main" to name a class, a variable, an enum, etc. You just can't call a function "main".

  • Thanks for your answer. I've understood. One question: Are you a c++ programmer? – Dmitrii Bundin Jun 27 '14 at 19:05
  • 1
    I work mainly in C#, but I've done some ANSI C way back when (as well as Perl, Java, SQL...). It's close enough that I am confident of my answer anyway :) – Tiercelet Jun 27 '14 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.