• Welcome to Valhalla Legends Archive.
 

simplebot

Started by vonLandenhausen, October 26, 2004, 08:35 AM

Previous topic - Next topic

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

vonLandenhausen


vonLandenhausen

damit, 8) == "8 )"   without the space in the middle

Mephisto

#3
Quote from: vonLandenhausen on October 26, 2004, 08:38 AM
damit, 8) == "8 )"   without the space in the middle

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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/pragm.asp

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.  ;)

Kp

#4
From the GCC manual (with regard to #pragma vs. other ways of passing directives) :
QuoteSome 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.
   2. There is no telling what the same #pragma might mean in another compiler.

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.
(Emphasis mine.)

[Edit: switched from bold to underline to make it show up better.]
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

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?

iago

Read what Kp emboldened. Then remember that most people use Visual Studio, and not Dev-C++.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*