Skip to main content
added 142 characters in body
Source Link
Roger Pate
Roger Pate

One of the most interesting grammars of any programming languages. Three

Three of these things belong together, and one istwo are something altogether different...

SomeType t = u; SomeType t(u); SomeType t(); SomeType t; SomeType t(SomeType(u)); 

All but the third oneand fifth define a SomeType object on the stack and initialize it (with u in the first two case, and the default constructor in the fourth. The third one is actually declaring a function that takes no parameters and returns a SomeType. The fifth is similarly declaring a function that takes one parameter by value of type SomeType named u.

One of the most interesting grammars of any programming languages. Three of these things belong together, and one is something altogether different...

SomeType t = u; SomeType t(u); SomeType t(); SomeType t; 

All but the third one define a SomeType on the stack and initialize it (with u in the first two case, and the default constructor in the fourth. The third one is actually declaring a function that takes no parameters and returns a SomeType.

One of the most interesting grammars of any programming languages.

Three of these things belong together, and two are something altogether different...

SomeType t = u; SomeType t(u); SomeType t(); SomeType t; SomeType t(SomeType(u)); 

All but the third and fifth define a SomeType object on the stack and initialize it (with u in the first two case, and the default constructor in the fourth. The third is declaring a function that takes no parameters and returns a SomeType. The fifth is similarly declaring a function that takes one parameter by value of type SomeType named u.

Source Link
Eclipse
  • 45.7k
  • 20
  • 117
  • 172

One of the most interesting grammars of any programming languages. Three of these things belong together, and one is something altogether different...

SomeType t = u; SomeType t(u); SomeType t(); SomeType t; 

All but the third one define a SomeType on the stack and initialize it (with u in the first two case, and the default constructor in the fourth. The third one is actually declaring a function that takes no parameters and returns a SomeType.

Post Made Community Wiki by CommunityBot