View previous topic :: View next topic |
Author |
Message |
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
What am I doing wrong with this syntax? |
Posted: Tue Jul 18, 2006 10:18 am |
|
|
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
|
|
Posted: Tue Jul 18, 2006 11:48 am |
|
|
I can't do anything without a test program. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Tue Jul 18, 2006 6:35 pm |
|
|
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!! |
|
|
|