ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Dyachenko <dyachenko@fromru.com>
To: ALT Linux Mailing List <devel@altlinux.ru>
Subject: Re: [devel] synaptic и  g++ 3.2.1 строки и итераторы
Date: Wed, 25 Sep 2002 18:57:39 +0200
Message-ID: <20020925165738.GA24525@deepblue.prokent.de> (raw)
In-Reply-To: <20020925134215.GA31165@basalt.office.altlinux.ru>

On Wed, Sep 25, 2002 at 05:42:15PM +0400, Dmitry V. Levin wrote:
> On Wed, Sep 25, 2002 at 11:47:33AM +0200, Alexey Dyachenko wrote:
> > Вот только при этом получил я ОЧЕНЬ неприятную новость.
> > 
> > std::string::iterator !=  const char *
> 
> Это уже очень давно не новость.

Увы, следить за всем, что происходит вокруг просто не успеваю.
Сейчас занялся изучением Tcl и от плюсов немного отошел.


> > То есть в 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).

Достал таки стандарт, действительно -- implementation defined.
Извиняюсь за ложную тревогу, пора снова садиться за книги.


> 
> > Если прав 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'а),
> по причине использования негарантированного свойства итератора.

Если можно -- объясни поподробней, где негарантированное свойство?
вроде * для итератора -- самый что ни на есть гарантированный оператор,
возвращающий объект. Для string итератор вроде должен быть random_access
(хотя я в этом сейчас поклясться не могу) и к нему + тоже должен быть
применим.

По хорошему -- конечно все это надо переписать нормально, но мне нужен был
быстрый результат, так что сделал "hack" в его оригинальном смысле
"hack  1. /n./ Originally, a quick job that produces what is needed, but not well."

Надеюсь, мантейнерам synaptic мой патч облегчит работу.


С уважением, Алексей Дьяченко.


      reply	other threads:[~2002-09-25 16:57 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
2002-09-25 16:57   ` Alexey Dyachenko [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=20020925165738.GA24525@deepblue.prokent.de \
    --to=dyachenko@fromru.com \
    --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