delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/08/23/22:51:28

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Fri, 23 Aug 2013 22:51:25 -0400
Message-Id: <201308240251.r7O2pPNB018514@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <3b166a82-36d9-4caa-acdf-dc37c382de00@googlegroups.com> (message
from Jim Michaels on Fri, 23 Aug 2013 19:36:53 -0700 (PDT))
Subject: Re: ambiguous man pages
References: <3b166a82-36d9-4caa-acdf-dc37c382de00 AT googlegroups DOT com>
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> the page states "Return Value:A pointer to a static structure which
> is overwritten with each call."
> 
> this is ambiguous. is the pointer overwritten, or is it the
> structure overwritten with each call?

You can't overwrite a return value, it's private to the caller's
scope.  The only thing in that sentence that *can* be overwritten is
the structure itself, and only because it's static to the function.

>   www.delorie.com/djgpp/doc/libc/libc_821.html
> 
> does this function allocate memory for the struct ptr? yes or no.

time_t is not a struct, so it can be returned as a scalar.  The passed
't' is *your* pointer, it's up to you to make it point to something.
So, there is nothing for the function to allocate.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019