This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warning : #167-D - for function sprintf

Hello, colleagues!

My question is about work with function sprintf in Keil C for ARM.

I have a structure for RTC, that looking as:

Fullscreen
1
2
3
4
5
6
7
8
9
struct {
unsigned char SEC;
unsigned char MIN;
unsigned char HOUR;
unsigned char DWEEK;
unsigned char DAY;
unsigned char MONTH;
int YEAR;
} RTC8583;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I try to write function that showing time:

Fullscreen
1
2
sprintf (BUFF,"%02d:%02d:%02d",
(unsigned)RTC8583.HOUR,(unsigned)RTC8583.MIN,(unsigned)RTC8583.SEC);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And after compilation, a message is displayed all the time:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
...
compiling M1132_MAIN.c...
MAIN\M1132_MAIN.c(284): warning:· #167-D: argument of type "BYTE *" is incompatible with parameter of type "char *restrict"
· ·························· sprintf (BUFF,"%02d:%02d:%02d", (unsigned)RTC8583.HOUR,(unsigned)RTC8583.MIN,(unsigned)RTC8583.SEC);
MAIN\M1132_MAIN.c: 1 warning, 0 errors
...··
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

I can’t understand how to do it right so that there is no warning!

It is still strange that neither in Borland C++, nor in Keil C for C51 such a   is observed!

Help me please!

 

0