9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] strdup()
@ 2002-04-10  1:30 dmr
  0 siblings, 0 replies; 9+ messages in thread
From: dmr @ 2002-04-10  1:30 UTC (permalink / raw)
  To: 9fans

strdup is not in c99.  I have the feeling
that the committees (pre '89 now and more lately)
were reluctant to start down the path
of putting externally visible malloc calls
into the library.

	Dennis


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [9fans] strdup()
@ 2002-04-10  1:41 rob pike, esq.
  2002-04-10  8:55 ` Anthony Mandic
  0 siblings, 1 reply; 9+ messages in thread
From: rob pike, esq. @ 2002-04-10  1:41 UTC (permalink / raw)
  To: 9fans

> strdup is not in c99.  I have the feeling
> that the committees (pre '89 now and more lately)
> were reluctant to start down the path
> of putting externally visible malloc calls
> into the library.

Heavens, no.  Dynamic memory allocation?  In C???
Bite your tongue.

-rob



^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [9fans] strdup()
@ 2002-04-09 13:56 rob pike, esq.
  2002-04-10 15:19 ` AMSRL-CI-CN
  0 siblings, 1 reply; 9+ messages in thread
From: rob pike, esq. @ 2002-04-09 13:56 UTC (permalink / raw)
  To: 9fans

> in the APE environment, strdup is in bsd.h (/sys/include/ape/bsd.h) as an extension.
> the manual pages describe the library for the Plan 9 native environment.
> 			options.nucl = strdup(optarg) ;
> strdup isn't declared and gets the default type of int, following C's B compatibility rules.

Yes.  For reasons I can't fathom, strdup is not in the ANSI C definition.
I hope C9X fixes this oversight.

-rob



^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [9fans] strdup()
@ 2002-04-09 12:23 forsyth
  2002-04-11  8:44 ` peter a. cejchan
  0 siblings, 1 reply; 9+ messages in thread
From: forsyth @ 2002-04-09 12:23 UTC (permalink / raw)
  To: 9fans

in the APE environment, strdup is in bsd.h (/sys/include/ape/bsd.h) as an extension.
the manual pages describe the library for the Plan 9 native environment.
			options.nucl = strdup(optarg) ;
strdup isn't declared and gets the default type of int, following C's B compatibility rules.



^ permalink raw reply	[flat|nested] 9+ messages in thread
* [9fans] strdup()
@ 2002-04-09 10:45 pac7
  2002-04-09 11:22 ` Lucio De Re
  0 siblings, 1 reply; 9+ messages in thread
From: pac7 @ 2002-04-09 10:45 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 26 bytes --]

Hi,

I have a problem:

[-- Attachment #2: strdup --]
[-- Type: text/plain, Size: 643 bytes --]



typedef struct {
	FILE *in ;
	FILE *out ;
	char *nucl ;
	int search_degenerate ; } opt_s ;

			options.nucl = strdup(optarg) ;

  cc -O -DPLAN9 -o  select select.c genpak.c  -lm
$  cc -o  select select.c genpak.c
/usr/pac/Test/gp-0.26/src/select.c:67[stdin:653] incompatible types: "IND CHAR" and "INT" for op "AS"
cc: cpp: 8c 1252:error
$

man strdup

...
          Strdup returns a pointer to a distinct copy of the null-
          terminated string s in space obtained from malloc(2) or `0'
          if no space can be obtained.


#############

Any hint?
TIA,
++pac
<pac7@post.cz> for the time being :-(


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-04-11  8:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-10  1:30 [9fans] strdup() dmr
  -- strict thread matches above, loose matches on Subject: below --
2002-04-10  1:41 rob pike, esq.
2002-04-10  8:55 ` Anthony Mandic
2002-04-09 13:56 rob pike, esq.
2002-04-10 15:19 ` AMSRL-CI-CN
2002-04-09 12:23 forsyth
2002-04-11  8:44 ` peter a. cejchan
2002-04-09 10:45 pac7
2002-04-09 11:22 ` Lucio De Re

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).