mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Bartosz Brachaczek <b.brachaczek@gmail.com>
To: musl@lists.openwall.com
Cc: He X <xw897002528@gmail.com>
Subject: Re: [musl] g++ fpermissive compilation error for strdupa
Date: Thu, 23 Jun 2022 09:40:26 +0200	[thread overview]
Message-ID: <CAGxPR--qDVetS=x6vB=uZJz=+Jr_Kt7w_K4jmKxuCOjf8OSOMg@mail.gmail.com> (raw)
In-Reply-To: <20220622131859.GM7074@brightrain.aerifal.cx>

On Wed, Jun 22, 2022 at 3:19 PM Rich Felker <dalias@libc.org> wrote:
> Maybe there's some way we can fix the C++ const issue but make it
> produce warnings when strdupa is used in both C and C++...?

How about:
#define strdupa(strdupa_is_unsafe) strcpy((char
*)alloca(strlen(strdupa_is_unsafe)+1),((strdupa_is_unsafe)?0:(long)(strdupa_is_unsafe)<<-1,(strdupa_is_unsafe)))

Or is that too ugly?

BTW, the C++ issue is not about const, but rather that void * is not
convertible to char * (only the other way around).

      parent reply	other threads:[~2022-06-23  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  8:05 He X
2022-06-22 13:19 ` Rich Felker
2022-06-23  2:59   ` He X
2022-06-23  3:07     ` Rich Felker
2022-06-23 19:25     ` Wolf
2022-06-24  5:24       ` He X
2022-06-23  7:40   ` Bartosz Brachaczek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGxPR--qDVetS=x6vB=uZJz=+Jr_Kt7w_K4jmKxuCOjf8OSOMg@mail.gmail.com' \
    --to=b.brachaczek@gmail.com \
    --cc=musl@lists.openwall.com \
    --cc=xw897002528@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).