Click here to Skip to main content
15,885,366 members
Articles / Programming Languages / Java
Alternative
Tip/Trick

C++ Syntax Uncovered

Rate me:
Please Sign up or sign in to vote.
3.00/5 (2 votes)
15 Dec 2010CPOL 8.9K   2   5
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:


C#
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)



Comments and Discussions

 
GeneralWolfgang: Ok, it was just a humble suggestion from my part, ... Pin
Lars P.Wadefalk3-Jan-11 10:34
Lars P.Wadefalk3-Jan-11 10:34 
GeneralReason for my vote of 1 "With" is by far the most evil langu... Pin
Wolfgang_Baron3-Jan-11 6:45
professionalWolfgang_Baron3-Jan-11 6:45 
GeneralThank you Lars, Thins is neither my article to delete it, no... Pin
Mohammad Nasim15-Dec-10 23:57
Mohammad Nasim15-Dec-10 23:57 
Thank you Lars,
Thins is neither my article to delete it, nor i am an administrator here.
you can delete it. I can only accept it as an alternative for mine.
Thank you for being understanding
Generalyeah sorry I missed the scope of the article, I thought it w... Pin
Lars P.Wadefalk13-Dec-10 23:42
Lars P.Wadefalk13-Dec-10 23:42 
GeneralGreetings Lars, I am not sure i understand you. This article... Pin
Mohammad Nasim13-Dec-10 23:09
Mohammad Nasim13-Dec-10 23:09 

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

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