Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
Member Area
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Become a Member
-Why sign up!
-Chat Online!
-Indexes NEW!!
-Build your resume
-Find a job
-Post a job
-Resume Search
-Link to us
Visit Embarcadero
Embarcadero Community
What is __fastcall and how to use it in your algorithms Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
What is __fastcall 26-Apr-04
CBuilder All Versions
User Rating
# Votes
Stubbs, David W
Reference URL:
			This is a revision:

1): I have made a few needed corrections
2): provided additional references for greater detail, proof and clarity .

New Title: What is __fastcall , how to use it the whens and whys of use  too.

When you look in the C++ Builder Forms code structure you will
find the word _fastcall.

Ever wonder what  _fastcall is ?

Well, it is a keyword and a calling convention built into
the Borland  C++ Builder.

Can it be hardcoded into your applications?
Yes, but there are times when you must for compilation reasons.

Sometimes it dosn't matter to the compiler whether a function
uses __fastcall or not.

Does __fastcall make your applications run faster? Maybe not.

Here are three sites which provide additional answers and proof of
use when considering __fastcall in your applications.

A C++ builder developers experience or accounts for use of __fastcall.
Good Short descriptions of use considerations: simply put and to the point.

Dictionary like reference description from the MSDN library.
Msdn library : type keyword __fastcall

A Good read. Kent Reisdorphs "C++Builders journal"
Find out how fast and if faster one function is against a __fastcall

Presents: time trials for a function using __fastcall and not.
Explains some use considerations as well.

His article may be found at:

Some answers to questions

_fastcall is a keyword.
The msdn library has specific information of its use.

What are its benifets when compared to not using it?
In general there are none except when working with the VCL if you
want your application to compile.

How about, Can you use it as hardcode for your apps?
Yes, you can, and It can be used for both console and windows apps.

When is __fastcall  required?
_fastcall is required when working with VCL code.

It works to get your functions closer to the Borland C++ builder compiler
and closer than function calls  that are declared without it. As a result
function calls run faster. 

CORRECTION: Actually, functions may not run faster.
See C++Builder Journal reference

An Example of using __fastcall

How to define and declare __fastcall for your own use.
define __fastcall in .h and .cpp files with user defined functions
in a class called TCalcs.

Example: Consider a Class TCalcs  which has two functions

1):In the Declarations of a class of .h file : How to assign __fastcall

   : Place fastcall between the variable type and the function name.

   : Double __fastcall WhatisVolume()

   : void __fastcall WhatisSquare(Double North,Double East)

2): In class function definitions of .cpp file : How to assign __fastcall

   Function #1) Type double
   : Double __fastcall TCalcs::WhatisVolume()

   : Your calculation methods here

   Function #2) Type void
   : void __fastcall TCalcs::WhatisSquare(Double North, Double East)
   : Your calculation methods here

3): Once declared here's how to use the functions in your app.
   : Call it in your main program using the JUST the name of the function

   : _fastcall is not needed in the main part of your app.

console app following main

   : WhatisVolume()

   : WhatisSquare(100,100)

C++ Builder help files has more info on __fastcall use and limitations

David W. Stubbs

Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10


Share this page
Download from Google

Copyright © Mendozi Enterprises LLC