[질문] 다음과 같은 함수 선언문의 의미는?

omando의 이미지

C++로 작성된 코드를 분석중에 다음과 같은 이해할수 없는 함수들이
여러 군데에 선언되어 있던데요.

LPCTSTR __fastcall SkipComments(LPCTSTR Str);
..
bool  __fastcall GetValueFrom(CMyType Type, char *Src);
..
QueueElm * __fastcall CCommonQueue::GetWithoutLock(void);
등등의 함수에서
Retrurn type과 함수명 사이에 _fastcall 이라는게 들어가 있는데
왜 삽입된건지
문법적으로 문제는 없는건지. 의도가 무언지 모르겠어요.
이런 형식의 함수는 첨보는거라 어렵군요.

글구 별도로 Type.h라는 파일에 _fastcall이 정의되어있습니다
....
...

#define	__fastcall

typedef	unsigned char    UCHAR;
typedef	unsigned short   USHORT;
typedef	unsigned int       UINT;

typedef short int	          SHORT;

#ifdef __USE_4BYTES_LONG
typedef int  	          LONG;
typedef	unsigned int       ULONG;
#else
typedef long	          LONG;
typedef	unsigned long    ULONG;
#endif

typedef	UCHAR	BYTE;
typedef	USHORT	WORD;
typedef	UINT	DWORD;

typedef	bool	boolean;
typedef	bool	BOOLEAN;
typedef	bool	BOOL;
typedef void *		LPVOID;

typedef const char *              LPCTSTR;
typedef LPCTSTR		LPCSTR;
typedef char *		LPTSTR;
...
...
익명 사용자의 이미지

__fastcall은 함수에 인수를 전달할 때 __stdcall처럼 스택에다 쌓지 말고 레지스터를 통해 직접 넘겨주라는 뜻입니다. __fastcall 타입의 함수는 컴파일하고 나면 심볼명 앞에 @가 붙게 됩니다.

charsyam의 이미지

함수 호출 방식이 있습니다. cdecl, fastcall, stdcall, pascal 등 말입니다.

fastcall의 경우 파라매터 두 개만 레지스터에 집어넣고 나머지는 스택에 넣습니

다. 그러니깐 두 개만 파라매터를 쓰면 훨씬 빠르겠죠

나머지는 한번 찾아보세요.

=========================
CharSyam ^^ --- 고운 하루
=========================

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.