ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Borland C++ Builder Contest

Learning C++ Builder

<< < (3/5) > >>

Shed:
hello...looks...some differences between pascal and c++

- In C/C++ lenguage, you use 'Include' directive for include files with header files (i think in Delphi this is PAS Units but don't know very well.....)

- C++ uses open and close brackets ---- {    and    } for delimit blocks.....not Begin and End

- properties are referenced by -> operator...

   but also, accesing to some structure members or conversion routines in execution...can be obtained with '.' character

    example accessing a property in a TTable component:

TTable->Filtered = True;   //enabling filtering for Table
--- End quote ---

    example accessing format converting method:

AnsiString String_question = "Pascal or C++?? that's the question";
char other_string[200];
   
            other_string = String_question.c_str();  //we're converting from Ansistring type, to C standard formatted string
                                              // some others are -----   .ToInt()
                                              //                                  .ToDouble();   ... etc...
           


--- End quote ---

- the end of line in C and C++ it's always marked with ';' character

- assign to variables ...is not ':=' operator....just '=' operator for assign the value....or '==' operator to compare with something

- Strings are delimited by double quotation character ....not simple quotation....except in some cases...


hope this helps you understand C++ code

Rover:
Way back in the 1980's (big hair, bad music) someone created a neat little file that made C look almost exactly like Pascal.  They used the (brain dead moment here...) pre-compiler thing.  Ughh! 

In C you can create shortcuts for almost anything and just before the source code is sent to the complier, it is run through a find/replace process.  I can't remember what it's called... too sticking early in the morning ...
Anyway it would basically allow something like this:

Define BEGIN  {
Define END     }

So that:
 BEGIN
   do some fancy programming stuff;
   programmers are cool;
 END

Would be converted to
 {
   do some fancy programming stuff;
   programmers are cool;
 }

It was pretty cool, but just enough different from real pascal to make it a pain to try to use.  ;D

Someone help my brain and tell me what that whole process is called before I freaking die.  :'(

mouser:
you are talking about the C++ Preprocessor (http://www.cplusplus.com/doc/tutorial/preprocessor.html).
the subject of much debate and misuse, which can be made to do some strange stuff.

by the way if you thought that was confusing, you might enjoy:
The International Obfuscated C Code Contest
http://www0.us.ioccc.org/main.html

Official Goals of the Contest

* To write the most Obscure/Obfuscated C program under the rules below.
* To show the importance of programming style, in an ironic way.
* To stress C compilers with unusual code.
* To illustrate some of the subtleties of the C language.
* To provide a safe forum for poor C code. :-)

ps. the real goal of the contest is to see who can make c code that will break your brain with its insanity.

app103:
Here is a real list of differences between Delphi & C...and it may explain why I am shakey at win32api stuff.

http://delphi.about.com/od/windowsshellapi/l/aa101303a.htm

Any similarities I may have implied between Delphi & C/C++ was in mentioning that the IDEs of Delphi & BCB were similar...not the languages.

Delphi 6:
Learning C++ Builder

Rover:
you are talking about the C++ Preprocessor (http://www.cplusplus.com/doc/tutorial/preprocessor.html).
the subject of much debate and misuse, which can be made to do some strange stuff.
-mouser (April 19, 2006, 07:04 AM)
--- End quote ---

Yup, that's the bugger.  I kept wanting to call it a pre-compiler...   :-[

The International Obfuscated C Code Contest

ps. the real goal of the contest is to see who can make c code that will break your brain with its insanity.
-mouser (April 19, 2006, 07:04 AM)
--- End quote ---

I used to read some C language magazines and they would usually have a similar contest.  It was UGLY.  The 2 line programs are nice in the same sort of way.  Scares me just to think about them.  :o

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version