[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: C question
On Sat, 03 Mar 2007 03:23:22 +0000 (GMT)
carzrgr8@xxxxxxxxxxxxx wrote:
> Look at the following:1) int bob[5] = {0x1, 0x2];2) int const bob[2] =
> {0x1, 0x2};3) static int const bob[2] = {0x1, 0x2};1 creates an
> initialized array in ram.2 creates a read-only array - presumably in
> ROMWhat does 3 do? I think 3 compiles to a read-only area of ram. Am
> I correct?gene
Though I can't image the reason to put this question on this forum,
here's what I think:
'Static' is normally reserved to specify the data should never be
destroyed by the compiler if the compiler thinks it's not necessary any
more (eg. to make data 'static', i.e. available between function calls to
the same function).
'const' means the program shouldn't be able to change it. Like you said,
make it read-only.
John
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user