ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] str*(3) - C vs. C++
Date: Mon, 15 Jun 2009 19:49:57 +0400
Message-ID: <20090615154957.GM10055@altlinux.org> (raw)
In-Reply-To: <20090615135121.GE27042@altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 698 bytes --]

On Mon, Jun 15, 2009 at 05:51:21PM +0400, Alexey I. Froloff wrote:
> On Mon, Jun 15, 2009 at 05:13:55PM +0400, Damir Shayhutdinov wrote:
> > > char *foo(const char *s, const char *a)
> > тут должно быть const char* foo
> О мой мозг.  Как жеж я "люблю" Си+плюс.

В си+плюсе функции могут быть перегружены: если аргумент константный,
то и значение константное; а второй прототип соответственно без const
то и другое.  Когда людишки функцию вызывают, то си+плюс смотрит, какой
прототип надо выбрать.

Это написано в книжке "Страус" на странице 666.

Соответственно в string.h у функций типа strchr два прототипа:
char *strchr(char *s, int c);
const char *strchr(const char *s, int c);

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-06-15 15:49 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
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 [this message]
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=20090615154957.GM10055@altlinux.org \
    --to=at@altlinux.ru \
    --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