delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2012/08/28/19:41:49

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:date:message-id:subject:from:to:content-type;
bh=lVPUyMk9wBcGLuFRFwWO/+QPjthOpfmwaJE06lwTauo=;
b=fvnIDIvV2ckyvqgbWar8Pl3C+HV88qrpERrwyhnji5nSzjoAybtogDHF9w44514Ntb
c68lQloCt2OBp8//rgk4J49JflwKOC5ovfI/1sR0gI3yoHQqTnLja80w/VQ3V/yfwUx0
iQOni6i4ftpP7bhQ93/hw85q8nWH4ViLNdWSixC6W/gTR2OuHW6f1gi5foIrWkEWU2eG
uLwcrbIgJjOSa1zYexRC4zNUrj/f3IrDZd2Pu0jXpYnkAFSilWhusopmy77qgS9EyH+w
LZDtw3vw/VpkDSBUWDAqK6UWG7NJCCDLdrJEqa+O0OtC9onx8mG5CTC8ofK7VN55RV4D
YlUg==
MIME-Version: 1.0
Date: Tue, 28 Aug 2012 18:13:50 -0500
Message-ID: <CAA-ihx-+juCuiapWVXVbJK5gWA-5NOd-idVGTXH93DNtaGN=Xg@mail.gmail.com>
Subject: memalign() -- backwards to Linux
From: Rugxulo <rugxulo AT gmail DOT com>
To: djgpp-workers AT delorie DOT com
Reply-To: djgpp-workers AT delorie DOT com

Hey guys,
   I hate to mention this, I know it's not that important, you're busy
with other things, but ... for clarity I figured it was still better
to be ignored than to omit.   ;-)

I read a while back that DJGPP's memalign() is backwards to Linux,
which I guess caused some minor inconveniences. I don't really know
the details, but a quick search shows this:

http://www.delorie.com/djgpp/doc/libc/libc_562.html

http://perkamon.alioth.debian.org/online/man3/posix_memalign.3.php

void *memalign(size_t size, size_t alignment); // DJGPP
void *memalign(size_t alignment, size_t size); // Linux

ANSI/ISO C   No
POSIX          No

(I know I know, shame on them using non-portable code.)

But there are apparently also these other options nowadays:

int posix_memalign(void **memptr, size_t alignment, size_t size);
void *aligned_alloc(size_t alignment, size_t size);
void *valloc(size_t size);

posix_memalign(): _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
aligned_alloc(): _ISOC11_SOURCE
valloc(): (... glibc 2.x ...)

Even if you don't find this that big a deal, wouldn't it be better to
use #warning or similar on this (and other things like fork) so that
nobody gets the wrong idea???

Any better ideas??

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019