Article View: fr.comp.lang.c
Article #15301Re: Paramètre constant
From: Emmanuel Delahaye
Date: Sat, 01 Oct 2005 16:13
Date: Sat, 01 Oct 2005 16:13
38 lines
2138 bytes
2138 bytes
Alain CROS wrote on 01/10/05 : > Dans une fonction d�clar�e : > int split(splitab *pt, char *c, const int taille, const char sep) Un caract�re �tant de type int, j'aurais mis int split(splitab *pt, char *c, const int taille, const int sep) en plus je ne pense pas qu'il existe r�ellement de param�tre de type char ... Si char est sign�, la conversion en int va ajouter du code... Autant m�ttre int directement, c'est plus simple et plus s�t. > le *c est un pointeur sur une chaine de char. > Je voudrais faire �voluer le pointeur *c++ Mauvaise id�e. Un param�tre n'est pas une variable locale. Je verrais bien tout en 'const' pour �viter �a, > mais interdire la modification de > la chaine en la d�clarant avec const. Je ne trouve pas o� mettre le const. > > const char *c et char const *c me donne : > [Warning] assignment discards qualifiers from pointer target type C'est portant la bonne solution. Poste le code de la ligne qui g�n�re ce warning. > char * const c me donne : > increment of read-only location Logique... -- Emmanuel The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html The C-library: http://www.dinkumware.com/refxc.html .sig under repair
Technical Details
Message-ID:
<mn.0c457d5a4b1d92ea.15512@YOURBRAnoos.fr>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-4.proxad.net!news18-e.free.fr!not-for-mailReferences:
<433eafec$0$18071$626a14ce@news.free.fr>Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,8be8da6b5abaf548 X-Google-Attributes: gidf9822,public X-Google-Language: FRENCH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!infeed-4.proxad.net!news18-e.free.fr!not-for-mail Subject: Re: Paramètre constant From: "Emmanuel Delahaye" <emdel@YOURBRAnoos.fr> References: <433eafec$0$18071$626a14ce@news.free.fr> Newsgroups: fr.comp.lang.c Message-ID: <mn.0c457d5a4b1d92ea.15512@YOURBRAnoos.fr> X-Newsreader: MesNews/1.04.00.00-fr Date: Sat, 01 Oct 2005 18:13:37 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit Lines: 40 Organization: Guest of ProXad - France NNTP-Posting-Date: 01 Oct 2005 18:13:38 MEST NNTP-Posting-Host: 81.65.109.78 X-Trace: 1128183218 news18-e.free.fr 21278 81.65.109.78:16540 X-Complaints-To: abuse@proxad.net