Click here to Skip to main content
11,431,171 members (68,961 online)
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

C++ Syntax Uncovered

, 15 Dec 2010 CPOL
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, ... Pin
Lars P.Wadefalk3-Jan-11 11:34
memberLars P.Wadefalk3-Jan-11 11:34 
GeneralReason for my vote of 1 "With" is by far the most evil langu... Pin
Wolfgang_Baron3-Jan-11 7:45
memberWolfgang_Baron3-Jan-11 7:45 
GeneralThank you Lars, Thins is neither my article to delete it, no... Pin
Mohammad Nasim16-Dec-10 0:57
memberMohammad Nasim16-Dec-10 0:57 
Generalyeah sorry I missed the scope of the article, I thought it w... Pin
Lars P.Wadefalk14-Dec-10 0:42
memberLars P.Wadefalk14-Dec-10 0:42 
GeneralGreetings Lars, I am not sure i understand you. This article... Pin
Mohammad Nasim14-Dec-10 0:09
memberMohammad Nasim14-Dec-10 0: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 | Terms of Use | Mobile
Web03 | 2.8.150428.2 | Last Updated 15 Dec 2010
Article Copyright 2010 by Lars P.Wadefalk
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid