delorie.com/archives/browse.cgi | search |
From: | "Tim Nicholson" <T DOT J DOT Nicholson AT btinternet DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: trouble with pointers |
Date: | Thu, 19 Apr 2001 19:23:47 +0100 |
Organization: | Skyforce avionics Limited |
Lines: | 74 |
Message-ID: | <9bnak4$orn$1@uranium.btinternet.com> |
References: | <9bn9ja$f53$1 AT plutonium DOT btinternet DOT 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 |
It's Ok - I have found the problem. I had another time.h in the include path which was being found prior to the DJGPP one. The reason that example three did not cause a problem was because I had already solved the problem without knowing it by the time I tried that! At least I know what is going on now, pity I did not work it out 5 mins earlier! Tim "Tim Nicholson" <T DOT J DOT Nicholson AT btinternet DOT com> wrote in message news:9bn9ja$f53$1 AT plutonium DOT btinternet 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 |