Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Tagged as

Go to top

C++ Syntax Uncovered

, 15 Dec 2010
Rate this:
Please Sign up or sign in to vote.
I have sometimes wondered if the 'with' statement would work in C/C++, just like in pascal. Meaning that it would in it's nearest scope automatically recognize class/struct members for the ones mentioned with a . or maybe -> operator.Maybe something like:TestClass* tc;float...

I have sometimes wondered if the 'with' statement would work in C/C++, just like in pascal. Meaning that it would in it's nearest scope automatically recognize class/struct members for the ones mentioned with a . or maybe -> operator.

Maybe something like:

TestClass* tc;
float test;
...
with tc {
  test = .memberx * .membery;
}

Would that cause confusion in code or unsafe exposure of variables ... like opposite to namespace perhaps?

And another thing, why can't we specify the data size for enums? That cause problems when accessing data over different architectures or networks.

I know that C++0X will have that, but maybe this should go into the langauge standards?

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralWolfgang: Ok, it was just a humble suggestion from my part, ... PinmemberLars P.Wadefalk3-Jan-11 10:34 
GeneralReason for my vote of 1 "With" is by far the most evil langu... PinmemberWolfgang_Baron3-Jan-11 6:45 
GeneralThank you Lars, Thins is neither my article to delete it, no... PinmemberMohammad Nasim15-Dec-10 23:57 
Generalyeah sorry I missed the scope of the article, I thought it w... PinmemberLars P.Wadefalk13-Dec-10 23:42 
GeneralGreetings Lars, I am not sure i understand you. This article... PinmemberMohammad Nasim13-Dec-10 23:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 15 Dec 2010
Article Copyright 2010 by Lars P.Wadefalk
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid