guile-devel
[Top][All Lists]
Advanced

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

Re: scm_* equivalent of gh_scm2newstr


From: Martin Baulig
Subject: Re: scm_* equivalent of gh_scm2newstr
Date: 02 Sep 2001 17:44:50 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Dirk Herrmann <address@hidden> writes:

> First, the function gh_scm2newstr works the other way around:  Taking a
> scheme string, and returning a null terminated C string as a copy of it.

Ooops, yes. Should have read closer - I thought he was talking about
gh_str02scm().

But for gh_scm2newstr there is already a replacement: SCM_STRING_CHARS()
and SCM_SYMBOL_CHARS() - except that they don't copy the string - but is
this really a problem, as you can just strdup() the result ?

> Second, I don't consider it a good idea to pack different functions into
> one, choosing their actual behaviour by some magic parameter values.  I am
> glad that a lot of such stuff has been removed from guile in the past
> time.

Hmm, that's really true.

So we probably need some scm_str2string() and scm_str2symbol() - and choose
a better name for them - IMO it's very inconvenient that you always need to
specify the length, especially if you have code like

        scm_mem2symbol (some_array [j].struct_field,
                        strlen (some_array [j].struct_field));

or even

        tmp = func_which_returns_static_string ();
        scm_mem2symbol (tmp, strlen (tmp));

-- 
Martin Baulig
address@hidden (private)
address@hidden (work)



reply via email to

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