Re: const int value changing....



"Keith Thompson" <kst-u@xxxxxxx> wrote in message
news:lnll2t3rpj.fsf@xxxxxxxxxxxxxxxxxx
> "Mabden" <mabden@xxxxxxxxxxxxxx> writes:
> > "Keith Thompson" <kst-u@xxxxxxx> wrote in message
> > news:lnll2u71e6.fsf@xxxxxxxxxxxxxxxxxx
> >> "shyju_kambi" <n.shyju@xxxxxxxxx> writes:
> >> > when a 'const int ' is declared, where is it been created(in
RAM?)
> >> >
> >
> >> If you want to modify an object, don't declare it const. If you
> >> declare an object const, don't try to modify it.
> >>
> >
> > Nice, but for extra points, could you make it more Zen-like?
> >
> > I'm thinking something like:
> >
> > Solid meets fluid. Definition enhances knowledge.
>
> Let us know when you have something useful to add to the discussion.
>

Solid meets fluid: A constant (solid) should not be changed (fluid).

Definition enhances knowledge: The declaration (definition) of the
object lets one know (enhances knowledge) about how the object should be
used.

Since it was merely a restatement of your own words, I thought you of
all people could find it "useful to the discussion". And others, those
with a sense of humor or familiarity with other cultures, might be
slightly amused.

For more extra points, you could also try using Haiku:

Modify object
But not if it is constant
That would be so wrong


Let us know when you have taken your Midol.

--
Mabden


.



Relevant Pages

  • Re: const int value changing....
    ... > If you want to modify an object, don't declare it const. ... > declare an object const, ... Prev by Date: ...
    (comp.lang.c)
  • Re: const int value changing....
    ... >> If you want to modify an object, don't declare it const. ... >> declare an object const, ... Prev by Date: ...
    (comp.lang.c)
  • Re: Property... why?
    ... >>if you want to access and modify your field, declare it as public is more ... that you don't want to modify his value from outside the class. ... Declaring a field as private and accessing with a property is good object ... It enables a class to encapsulate data which it has sole ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Property... why?
    ... >>>if you want to access and modify your field, declare it as public is more ... > there's a contradiction here because declaring your field as private means ... > that you don't want to modify his value from outside the class. ... is because the design time environment relies on ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Local copy of variable not acting locally
    ... > I want to declare a local copy of an object so I can modify the local ... > version without affecting the original copy. ... > Private Sub MySub1 ... my intention is to modify MyLocalObject without ...
    (microsoft.public.dotnet.languages.vb)