[RFClue] Constant declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I hope somebody can explain this to me. :-)

In certain places I have seen the following code:
(e.g. scripts/pnmtologo.c or arch/ppc/platforms/chrp_setup.c)

static const char *foo = "ABC";

int main(int argc, char *argv[])
{
        foo = "some other value";
}


How can this be allowed? foo has been declared constant and yet is being 
assigned a new value ?

Also, I have seen a lot of: const char *foo = "";
There would be no point in declaring a constant empty string so it must be 
given a new value elsewhere in the code.

Please tell me what is going on :-)
regards,
Felix

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux