Valhalla Legends Forums Archive | C/C++ Programming | simplebot

AuthorMessageTime
vonLandenhausen
hej,
i just took a look at skywings simplebot example.
what does:

#pragma intrinsic(memcmp, memcpy, memset, strcat, strcmp, strcpy, strlen)

#define MAKEIP(b4,b3,b2,b1) ((LPARAM)(((DWORD)(b1)<<24)((DWORD)(b2)<<16)((DWORD)(b3)<<8)((DWORD)(b4))))
#define RENDIAN_WORD(W) ((HIBYTE(WORD(W)) >> 0) | (LOBYTE(WORD(W)) << 8))

mean?  ;D
thx
October 26, 2004, 1:35 PM
vonLandenhausen
8) == "8)"
October 26, 2004, 1:37 PM
vonLandenhausen
damit, 8) == "8 )"  without the space in the middle
October 26, 2004, 1:38 PM
Mephisto
[quote author=vonLandenhausen link=topic=9322.msg86183#msg86183 date=1098797880]
damit, 8) == "8 )"   without the space in the middle
[/quote]

Please stop double-posting.  You could've put all three of those posts into one by using the edit button.  You could also use [ code ] [ /code ] tags to prevent emoteicons from interfering with your code, or disable them in your post...

Anyways, to your question:  #pragma is a preprocessor command with many cool abilities.  One is to alert the compiler to make all function code inline (rather than a function call) for intrinsic functions you declared in your pragma statement.  There's only certain intrinsic functions that can be made intrinsic through the pragma command.  For a detailed list of all pragma directives including intrinsic, go to: [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/pragm.asp[/url]

As for his macros, just look at the code...First he's typing casting the variables, then using bit-manipulation on them with bitwise operators.  Perhaps he's doing fast multipalcation/division...It's kind of difficult to know exactly what it's used for without the code it's used in.  ;)
October 26, 2004, 2:10 PM
Kp
From the GCC manual (with regard to #pragma vs. other ways of passing directives) :
[quote]Some people object to the __attribute__ feature, suggesting that ISO C's #pragma should be used instead. At the time __attribute__ was designed, there were two reasons for not doing this.

  1. It is impossible to generate #pragma commands from a macro.
  [u]2. There is no telling what the same #pragma might mean in another compiler.[/u]

These two reasons applied to almost any application that might have been proposed for #pragma. It was basically a mistake to use #pragma for anything.[/quote](Emphasis mine.)

[Edit: switched from bold to underline to make it show up better.]
October 26, 2004, 3:16 PM
vonLandenhausen
i tried to compile simplebot.cpp with dev-cpp and got following errors:

82 E:\c++\windows.devcpp\main.cpp:138 [Warning] multi-character character constant

E:\c++\windows.devcpp\main.cpp In function `void Main()':

168 E:\c++\windows.devcpp\main.cpp `__assume' undeclared (first use this function)

  (Each undeclared identifier is reported only once for each  function it appears in.)

E:\c++\windows.devcpp\Makefile.win [Build Error]  [main.o] Error 1

you can see the code here: http://www.nomorepasting.com/paste.php?pasteID=23546

or direct from skywing:
http://www.valhallalegends.com/skywing/files/MiniChat.cpp

Does anyone have an idea whats wrong?
October 26, 2004, 5:25 PM
iago
Read what Kp emboldened. Then remember that most people use Visual Studio, and not Dev-C++.
October 26, 2004, 10:36 PM

Search