| delorie.com/archives/browse.cgi | search |
| From: | "Tim Nicholson" <T DOT J DOT Nicholson AT btinternet DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | trouble with pointers |
| Date: | Thu, 19 Apr 2001 19:07:15 +0100 |
| Organization: | Skyforce avionics Limited |
| Lines: | 59 |
| Message-ID: | <9bn9ja$f53$1@plutonium.btinternet.com> |
| NNTP-Posting-Host: | host62-7-113-168.btinternet.com |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2919.6600 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6600 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Could someone please explain what I getting wrong here (I am using DJGPP and
Rhide). I get a warning error with example one but not with example two or
three. It is example one that I want to use. I could use example to, but why
is the cast required. Example three is not what I want but it does
highlight something (i think).
Regards
Tim
-----Example one--------------------
#include "time.h"
static struct tm *mytime_t;
static unsigned int mytod;
void my_get_time(void)
{
time(&mytod);
mytime_t = gmtime(&mytod); <=== Warning error - why?
}
WARNING - assignment makes an integer from a pointer without cast (or words
to that effect)
----Example two---------------------
#include "time.h"
static struct tm *mytime_t;
static unsigned int mytod;
void my_get_time(void)
{
time(&mytod);
mytime_t = (struct tm*) gmtime(&mytod);
}
No errors reported
----Example three--------------------
#include "time.h"
static unsigned int mytod;
void my_get_time(void)
{
struct tm *mytime_t;
time(&mytod);
mytime_t = (struct tm*) gmtime(mytof);
}
No errors reported
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |