CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Is [][*] for 2dim Arrays non-Standard in C? [ANSWERED]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

Is [][*] for 2dim Arrays non-Standard in C? [ANSWERED]
PostPosted: Sat May 25, 2013 3:21 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat May 25, 2013 5:23 pm     Reply with quote

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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat May 25, 2013 6:25 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group