Questions about begin_code.h

Hello sdl freaks,

  mkey, we got vc++ 6.
  i am not too experienced w32 coder.
  
  explain me please why to use 4 bytes aligment.
  mkey, i know what aligment is and why 4 bytes.
  i was thinking that compiler do aligning on his own anyway.

  hmm... a long time ago i was aligning i.e. 64kb texture teables
  on 64k, but now?

  and, is it possible to handle all these functions as c++ instead
  of extern ? declarations i mean....hm?-- 

Best regards,
firefox mailto:@palpetine

Tego nie znajdziesz w zadnym sklepie!
[ http://oferty.onet.pl ]

  explain me please why to use 4 bytes aligment.

On 32-bit platforms, aligning by 32-bits (4 bytes) tends to be faster.

  and, is it possible to handle all these functions as c++ instead
  of extern ? declarations i mean....hm?

You want to call SDL functions from C++? You can do so.

If you want SDL wrapped into C++ classes, look at:
http://www.libsdl.org/libraries.html

Specifically: libMgTk, SDLucid, SDLmm, SEL

–ryan.

Hello sdl freaks,

  mkey, we got vc++ 6.
  i am not too experienced w32 coder.

  explain me please why to use 4 bytes aligment.
  mkey, i know what aligment is and why 4 bytes.
  i was thinking that compiler do aligning on his own anyway.

Well, the point is just to make real sure the same alignment is used
for your code as for the SDL library. Won’t be much fun accessing SDL
structs otherwise… :slight_smile:

  hmm... a long time ago i was aligning i.e. 64kb texture teables
  on 64k, but now?

Now we’re getting off-topic…

That’s a totally different matter. And either way, why 64 kB? If you’re
talking about Real Mode or 16 bit Protected Mode, both can address at
most 64 kB without changing a segment/selector register. The former needs
alignment to 16 bytes (address = seg << 4 + offs), while the latter has
completely different, and much more complicated rules. Basically, the
actual offset values (along with other info) is stored in “structs” that
are “selected” by the selector registers, so the selector registers are
just “numbers” with no direct relation to the linear address.

  and, is it possible to handle all these functions as c++ instead
  of extern ? declarations i mean....hm?

What? Indeed, ‘extern’ isn’t really required for functions in most
compilers, but that doesn’t differ between C and C++.

Either way, SDL is written in C, to provide a plain, simple and fast C
API that can be used with C or C++ directly, or wrapped to be used from
pretty much any other language.

Involving C++ would add nothing but trouble and a bunch of ways to slow
SDL down in non-obvious ways - not to mention breaking compatibility with
at least 99% of all existing code that uses SDL. Why bother?

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 12 December 2001 12:54, firefox wrote: