View previous topic :: View next topic |
Author |
Message |
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
Is [][*] for 2dim Arrays non-Standard in C? [ANSWERED] |
Posted: Sat May 25, 2013 3:21 pm |
|
|
Hey all,
I've seen recommended here to use in CCS [][*] when allocating a 2dimensional array where there's an unspecified number of variable length strings the the array.
Is this considered non-standard C? It works in PIC-C but not elsewhere..
(just wondering as I can't find it in my K&R C Programming Language reference)
Thanks,
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D
Last edited by bkamen on Sat May 25, 2013 6:26 pm; edited 1 time in total |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat May 25, 2013 5:23 pm |
|
|
The const char id [] [*] syntax is clearly marked as non-standard C feature in the compiler manual.
As discussed in previous threads, the suggested CCS specific features don't work with all compiler versions. I don't know the state with present CCS C versions.
http://www.ccsinfo.com/forum/viewtopic.php?t=48456
http://www.ccsinfo.com/content.php?page=compiler-features
The nearest standard C method to implement string arrays of variable length is an array of string pointers: const char *id []
Due to PIC restrictions for constant strings pointers, it doesn't work well with 8-bit PICs. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sat May 25, 2013 6:25 pm |
|
|
Thanks for the sanity check.
I thought I saw it somewhere, but couldn't remember where...
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|