From: "Dmitry V. Levin" <ldv@altlinux.org>
To: ALT Linux Mailing List <devel@altlinux.ru>
Subject: Re: [devel] synaptic и g++ 3.2.1 строки и итераторы
Date: Wed, 25 Sep 2002 17:42:15 +0400
Message-ID: <20020925134215.GA31165@basalt.office.altlinux.ru> (raw)
In-Reply-To: <20020925094733.GB31139@deepblue.prokent.de>
[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]
On Wed, Sep 25, 2002 at 11:47:33AM +0200, Alexey Dyachenko wrote:
> Мне тут понадобился работающий графический клиент для apt и я немного
> похакал synaptic для сборки gcc 3.2.
> Патч прилагается.
>
> Вот только при этом получил я ОЧЕНЬ неприятную новость.
>
> std::string::iterator != const char *
Это уже очень давно не новость.
> То есть в gcc 3.2 basic_string::iterator объявлен как
> typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
>
> В stlport это объявлеятся как
> typedef const value_type* const_iterator;
> typedef value_type* iterator;
>
> и по моему здесь прав stlport.
Нет; итератор - это целиком и полностью implementation-defined.
Вообще говоря, по стандарту реализация std::string не гарантирует,
что std::string::iterator указывает на область памяти, содержащую строку
(да еще и NULL-terminated).
> Если прав stlport -- тогда срочно сяду собирать пакет для сизифа.
> Хотя это надо бы сделать в любом случае -- вещь полезная.
Конечно.
> --- synaptic-0.16/common/indexcopy.cc 2001-08-15 21:44:09 +0200
> +++ synaptic-0.16-gcc32/common/indexcopy.cc 2002-09-25 10:28:33 +0200
> @@ -402,7 +402,7 @@
> return;
>
> // Not a dists type.
> - if (stringcmp(Path.begin(),Path.begin()+strlen("dists/"),"dists/") != 0)
> + if (stringcmp( &( *Path.begin() ),&*( Path.begin()+strlen("dists/"),"dists/" ) ) != 0)
скобки тут лишние (хотя и не вредные).
когда-нибудь этот код может перестать работать (равно как и код apt'а),
по причине использования негарантированного свойства итератора.
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2002-09-25 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-25 9:47 Alexey Dyachenko
2002-09-25 13:42 ` Dmitry V. Levin [this message]
2002-09-25 16:57 ` Alexey Dyachenko
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=20020925134215.GA31165@basalt.office.altlinux.ru \
--to=ldv@altlinux.org \
--cc=devel@altlinux.ru \
/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