octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

extern char *strptime () on FreeBSD 2.2.8


From: John W. Eaton
Subject: extern char *strptime () on FreeBSD 2.2.8
Date: Mon, 29 Jan 2001 08:56:11 -0600

On 26-Jan-2001, Trond Varslot <address@hidden> wrote:

| I have been trying to compile octave 2.1.33 on FreeBSC 2.2.8, and
| noticed that in the file
| liboctave/lo-cutils.c, the function strptime is defined as
| extern char *strptime ().
| This comflicts with the definition in /usr/inclide/time.h:
| const char *strptime().
| 
| I simply removed the prototype from lo-cutils.c, and octave seems to
| compile. I was not able to complete the linking, since the computer ran
| out of memory:(
| 
| My question is this: What reasons are there for defining a function
| prototype which is also defined in the included header files? Isn't the
| proper place for the definition of strptime in time.h? If there are no
| rationales behind doing it this way, I suggest we remove the prototype
| from lo-cutils.c as it gives the compiler hickups on FreeBSD 2.2.8.

strptime is not defined by ANSI C, so it is not necessarily going to
be declared by time.h.  On my system, it has the following prototype:

  # ifdef __USE_XOPEN
  /* Parse S according to FORMAT and store binary time information in TP.
     The return value is a pointer to the first unparsed character in S.  */
  extern char *strptime (__const char *__restrict __s,
                         __const char *__restrict __fmt, struct tm *__tp)
       __THROW;
  # endif

When I remove the declaration in lo-cutils.c and recompile, I see the
following warnings:

  liboctave/lo-cutils.c: In function `oct_strptime':
  lo-cutils.c:40: warning: implicit declaration of function `strptime'
  lo-cutils.c:40: warning: return makes pointer from integer without a cast

(presumably becuase __USE_XOPEN is not defined).

So, I think some kind of declaration is needed.  Do you have a better
solution that will work on all systems?

Thanks,

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]