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

What am I doing wrong with this syntax?

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



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

What am I doing wrong with this syntax?
PostPosted: Tue Jul 18, 2006 10:18 am     Reply with quote

With the following data structure

Code:

/* Directory object structure */
typedef struct _DIR {
   DWORD   sclust;      /* Start cluster */
   DWORD   clust;      /* Current cluster */
   DWORD   sect;      /* Current sector */
   WORD   index;      /* Current index */
} DIR;



If I have the following declaration:
Code:

FRESULT f_stat (
   char *path,   /* Pointer to the file path */
   FILINFO *finfo      /* Pointer to file information to return */
)
{
   FRESULT res;
   BYTE *dir;
   DIR dirscan;                  // <==== ERROR
   char fn[8+3+1]


The code fails compiling with a "Code has no effect" error.

However if I reorganize it like this it compiles ok
Code:
FRESULT f_stat (
   char *path,   /* Pointer to the file path */
   FILINFO *finfo      /* Pointer to file information to return */
)
   {
   DIR dirscan;                  // <==== NO ERROR
   FRESULT res;
   BYTE *dir;
   char fn[8+3+1]

[/code]

Second problem
Code:

static
char make_dirfile (
   char **path,      /* Pointer to the file path pointer */
   char *dirname         /* Pointer to directory name buffer {Name(8), Ext(3), NT flag(1)} */
)


The compiler spits the dummy at char **path but does not mind the following:

Code:

typedef char* pchar;
pchar *path;


They should be equivalent.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 18, 2006 11:48 am     Reply with quote

I can't do anything without a test program.
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Jul 18, 2006 6:35 pm     Reply with quote

Thanks - I found the first one. I ported someone elses code to CCS and I didn't realise they have used case to differentiate labels. Such as DIR and dir
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
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