Re: [ng-spice] A small bugfix for rework 11


To ng-spice@ieee.ing.uniroma1.it
From "Arno W. Peters" <a.w.peters@ieee.org>
Date Tue, 30 May 2000 21:49:35 +0200
Delivered-To mailing list ng-spice@ieee.ing.uniroma1.it
In-Reply-To <3933FFC1.A0D8CE66@gmx.de >; from ManfredMetzger@gmx.de on Tue, May 30, 2000 at 07:52:01PM +0200
Mailing-List contact ng-spice-help@ieee.ing.uniroma1.it; run by ezmlm
References <3932BC9F.FCF8FC81@gmx.de > <20000529221030.A2253@cgmd80028.chello.nl > <3933FFC1.A0D8CE66@gmx.de >
Reply-To ng-spice@ieee.ing.uniroma1.it
User-Agent Mutt/1.2i

On Tue, May 30, 2000 at 07:52:01PM +0200, Manfred Metzger wrote:
> "Arno W. Peters" wrote:
> 
> > Applied along with a total elimination of MALLOC() by using
> > asprintf().
> 
> Do you think it is a good idea to use such a non-standard function
> like asprintf()? I think it is not necessary in this case but makes porting
> to other systems harder. For example i have a HP 9000 Workstation
> which does not provide asprintf(). Yes, i have read the portability page
> on the ng-spice homepage but ...

Yes, for the following reasons:

1) asprinf() is available in C libraries on GNU and BSD systems and
thus standard and documented on those platforms.

2) asprinf() relieves the programmer from calculating the size of the
memory allocation for printing strings.  This is a Good Thing.

2) configure can check for asprinf() and define a macro
HAVE_ASPRINTF.  In case the function is not available, you are free to
add the function to the misc directory and enclose the whole function
with

  #ifndef HAVE_ASPRINTF
  int
  asprintf(char **strp, const char *format, ...)
  {
      /* Code copied (for example) from the FreeBSD C library */
  }
  #endif

I will accept patches that implement this function for ngspice and
integrate it into the archive.

I hope that answers your question.

Greetings,
-- 
Arno

PGP signature


Partial thread listing: