|
-
Aug 20th, 2001, 10:57 AM
#1
Thread Starter
New Member
What makes C and C++ what they are?
Hi everyone, if you dont mind I would like us to have a long discussion about the 2 programming languages C and C++. Why am i saying this on a VB site, well I am a VB user and I have been learning C++. There is a great difference in the two languages and I wanna know all there is about why C++ is just a good as everyone says it is.WARNING I AM NOT A C++ EXPERT SO I MAY MAKE MISTAKES HERE BE EASY.
To be honest I am against C++ for ONE thing: the syntax. Some of you may have seen the obfuscated C code competition somewhere on the net (www.ioccc.org). The things you can write with this language, God have mercy. Here is a short clip of some C code ( dont ask me what it does, I dunno and dont wanna know)
[x] );
} p(H,
H,r );
F; x;
) { E S=
e ; w l =
" !{ ,;lf6D@"
; j X 1-g; F; *++l;
){ *S++ =*j; j X*l%3*g-
g+*l%5*b-3*b; } y =M x-G);
y =M-J)* M-x)+ M-J-1)*y+.01; y=
sqrt((u+q[--x]+.1)/y ); o-=T; C i)+
#define Z(x)(t(0,(x-C)/y)-l+1e-6*(x-Q))
.5; K=M-B); { N f=I,Q=0; F; f-Q>c; ){ P l=0
; N H = C+c/2+1; H%=c; H X(f+Q+c-2*H)/2/c*c; l=
Z(Q); O=(A-W)*Z(H)/Z(f); _(O,R=B?K>= H:L/k>O+W); *(
R?&Q:&f)=H; } Q X f; *S=*j=Q/=2; s=B?s:Q+k; f=Q+n[x/z];
n[x/z]=x%z+J%(z*2/g)?f:!putc(x?l[4*g*f/z/z/I-8]:10,stderr);
H-=U; F O=156; O--; ){ H--; *H=e[O%U]*e[O/U]/y+.8**H; } C-=Q+.5
; y i/.9)-Q-C; p(p(r+T,r,r),H,r); h[x]=.7*h[x]+C*C; u X h[x]; u*=.7
; d X C>0?-y:y; } } j X 9; } _(_(x,x),x); } D 0; }
Now I know that people never write programs like that but I have seen some well formatted code thats not as attractive as it could be. Somebody one day just count how many operators you have in your C/C++ code in you'll see what I mean.
Then there are the little oddities such as the blasted semi-colon.
Compilers know when you have left it out and even know where it should have gone. Now somebody correct me if I am wrong, cant the compiler add it for you (in most cases). i can see what advantages the compiler has coz of it but in some cases I dont know why its needed. Somebody tell me whats wrong with this code:
class SomeUseLessThing
{
public:
int a;
void fn1(int b);
private;
int c;}
Forgive me if I am wrong but on one of those days, if you looked at the above code without the compiler there it would look fine. Even as you code it and finish things look pretty okay, try and compile then BAM!!!! "private;" should be "private:" and that the last brace should have a ; following it so the line would be "int c;};"
Following on, is the bracket. Its very much easier to type when compared to words in other languages such as Pascal's begin and end or VB's: Function BlahBlah()....End Function. But however its much harder to spot and pair up, especially when there loads:
int Function(int a, int b){//i hate this bracket's position
{/*block1*/ int c=23;{
/*block2*/ int e=12;} int f=12} int g=23}
These are some of the things, and give a beginner one or two of those for a couple of hours and boy are they in for a long night.
Now DONT BE MISTAKEN I KNOW THERE ARE GOOD THINGS ABOUT THIS LANGUAGE AS WELL.
I have evaluated it on other counts and it measures up. For instance the speed thing, I am a performance super freak so when it comes to writing super fast speed bombs, naturally C++ would be the pick. Only thing is, C++ isnt exactly a toy language. Learning the ins and outs of the beast will take long and I know the journey WILL NOT BE EASY.
Oh they are about to close the library just now, so thats it for now. Please give me your feelings on this language, share your experiences, likes and dislikes and we'll pickup again on it later.
Ps: wanna know why I want all these ideas and opinions? I want to create a better C++, a more readable but by all means just as powerful language. I have been working on it now for 3 months or so. What do you get when you cross breed C++ and VB well the answer is not a.(java) or b.(c#) its c.(Ciyana). Thats the code name of the language while its under development. Anyone interested please contact me( [email protected]). Here is an excerpt for hello world.
Public Function Main()
Reserve String StorageFor Msg = "Hello World"
Console.Write (Join(Msg, "From Ciyana"))
// the output is : Hello World From Ciyana
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|