gEDA-user: C question
John Coppens
john at jcoppens.com
Fri Mar 2 23:04:03 EST 2007
On Sat, 03 Mar 2007 03:23:22 +0000 (GMT)
carzrgr8 at optonline.net 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
More information about the geda-user
mailing list