ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Ivan A. Melnikov" <iv@altlinux.org>
To: devel@lists.altlinux.org
Subject: Re: [devel] str*(3) - C vs. C++
Date: Mon, 15 Jun 2009 09:45:47 +0400
Message-ID: <20090615094547.3f5b9f8b@deimos.localdomain> (raw)
In-Reply-To: <20090614233129.GA27042@altlinux.org>

On Mon, 15 Jun 2009 03:31:29 +0400
"Alexey I. Froloff" <raorn@altlinux.org> wrote:

> On Tue, Jun 09, 2009 at 02:37:06AM +0400, QA Team Robot wrote:
> > backends/midi/alsa.cpp:234: error: invalid conversion from 'const
> > char*' to 'char*'
> backends/midi/alsa.cpp:234: if ((p = strpbrk(arg, ADDR_DELIM)) ==
> NULL)
> 
> Где arg имеет тип const char *.
> 
> SYNOPSIS
>        #include <string.h>
> 
>        char *strpbrk(const char *s, const char *accept);
>                      ^^^^^^^^^^^^^
> 
> /usr/include/c++/4.4.0/cstring:  strpbrk(char* __s1, const char* __s2)
>                                          ^^^^^^^^^^
> /usr/include/c++/4.4.0/cstring:  { return
> __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
> ^^^^^^^^^^^^^^^^^^^^^^^
> 
> И как это называется?  Аналогично strchr(3) и др.
> 


Использую libstdc++4.4-devel-4.4.0-alt3. Здесь эти определения
присутствуют только если не определен символ препроцессора
__CORRECT_ISO_CPP_STRING_H_PROTO, который, вроде бы, должен
определяться в <string.h> из glibc-devel-2.10.1-alt2 на 37-ой
строке. Я успешно скомпилировал такое вот:

$ cat a.cpp 

#include <cstring>

const char* test = "Test";
const char* accept = "s";

int main()
{
    return std::strpbrk(test, accept) - test;
}

Полученный бинарник действительно возвращает код 2.

Может, у Вас какой-то string.h подсоввывается неправильный? Что за
пакет?

-- 
WBR,
Ivan A. Melnikov



  parent reply	other threads:[~2009-06-15  5:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-14 23:31 ` Alexey I. Froloff
2009-06-14 23:44   ` Led
2009-06-15  5:45   ` Ivan A. Melnikov [this message]
2009-06-15 13:04     ` Alexey I. Froloff
2009-06-15 13:13       ` Damir Shayhutdinov
2009-06-15 13:51         ` Alexey I. Froloff
2009-06-15 15:49           ` Alexey Tourbin
2009-06-15  7:40   ` Alexey Rusakov

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=20090615094547.3f5b9f8b@deimos.localdomain \
    --to=iv@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /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

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git