delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/02/16:59:38

Date: Fri, 02 Jun 95 14:51:48 -0400
From: Wonkoo Kim <wkim+@pitt.edu>
To: kwasik AT lodz2 DOT p DOT lodz DOT pl, djgpp users <DJGPP AT sun DOT soe DOT clarkson DOT edu>
Reply-To: Wonkoo Kim <wkim+@pitt.edu>
Subject: Re: Changing constants...

> Date: Fri, 02 Jun 95 18:12:55 -0400
> From: kwasik AT lodz2 DOT p DOT lodz DOT pl
> To: DJGPP AT sun DOT soe DOT clarkson DOT edu
> Subject: Changing constants...
> 
> Well...   When I compiled with bcc everything was OK. Then, I thought
> about gcc from DJGPP package and here's what I've found:
> 
> /* Program const.c */
> int main()
> {
>  int var1=13,var2 = 1;
>  const int* const swsi = &var1;
> 
>  /*There are two errors compiling as C++ !!!*/
>  (int *) swsi = &var2;          /*First*/
>  (int) *swsi = 2;               /*Second*/
>  return 0;
> }
> 
> Krzysztof Wa/sik
> e-mail: kwasik AT lodz2 DOT p DOT lodz DOT pl
 
This question should go to comp.lang.c++ or similar newsgroup.

The error was: 
Const pointer and const value can not be assigned after defined.

gcc did right.

//--------------------------------------------------------------------
// Wonkoo Kim
// wkim+@pitt.edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019