From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mike Gran Newsgroups: gmane.lisp.guile.user Subject: Re: Are char* and signed char* compatible (SCM_BYTEVECTOR_CONTENTS)? Date: Fri, 26 Feb 2021 03:15:10 -0800 Message-ID: References: <768f0a03350676677860ab874f79904a5acbe75b.camel@planete-kraus.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2506"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) To: Vivien Kraus , guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Feb 26 12:15:55 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFb6B-0000Xn-8C for guile-user@m.gmane-mx.org; Fri, 26 Feb 2021 12:15:55 +0100 Original-Received: from localhost ([::1]:40372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFb6A-0004HE-AY for guile-user@m.gmane-mx.org; Fri, 26 Feb 2021 06:15:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFb5i-0004G4-9v for guile-user@gnu.org; Fri, 26 Feb 2021 06:15:26 -0500 Original-Received: from sonic310-20.consmr.mail.gq1.yahoo.com ([98.137.69.146]:34348) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFb5c-0002E7-W5 for guile-user@gnu.org; Fri, 26 Feb 2021 06:15:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1614338116; bh=5oRBNcdx5bNCtt0m7RQJBfvO3lbvYaa3V+tFDJE1db8=; h=Subject:From:To:Date:In-Reply-To:References:From:Subject:Reply-To; b=IGxlTd0XsoBG7QbTtqqNiagHTpjd6k8jDfvAzUmZLqUmrSG8TBspv/68LwDENaomi+usk4lH/8TRKw8VdyWfda6WUzAujyf94sjB9o85N/s52kPPC0iP1gElXJ8cyoBRrjqy+79K2tzNlJGxuUzmJ71gV6c/+H4P7K7k2Mp+qjrx9neUTyGqe54A1DerxEOi0PHo3TXrF/amPYosKN9J4HYU9rOEmQ8C1pkwo2YpdPUeTbCeiO6ISjYzG+Y7i4v71sLO9+ufN7N+e+hQk4rvTgWvanzuS4IVqjylhwyZXw7+2dicMuJM9Sv639wRstGjvODImqdGNhdLZbfFti6+RQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1614338116; bh=Obiz3UaXjeKiGyp7Oxz17PB7yHFBbyjfWLAGi65q6RR=; h=X-Sonic-MF:Subject:From:To:Date:From:Subject; b=NM4b91YFaXE6zFgslSoojfIHvT5v2ht/oRYfXgwQaSpm0UqKe1hniKJDk/putWu5CBeaZL0JgYmkz7aTb9tloed8Upme6i4K5j3wExgCmdt3HALKrYuuLX2gVj8G60cQn/xqQ5AgpNKWHxwqpVtl3qXlVysCkJfkoYtAN79G7i8FxYxKjXQkBPRyQtJYK1uPmnvWszAKIC+r5yQtky4iQv0kxmOyR1HbtUI6VMzjR+4lHz7iiIRzlvG7bRO6t1A+aS2nYqde92AMfCiawD4UkwKZHlBHeNcqJHE7jVwgDhM7ZN/vBpmHo1aJZDTqgxqfR7F638741J8YIbzFT0u35A== X-YMail-OSG: hprY6Q4VM1mS7P.rbslIdNI.sPz9.rkPqaXbrPh3rpj8htpIt26lpP6O3IU3auH Mktxtb64gkLXcenC3DrAvWRUv.gOqmZ1b5aEnL2wuLhnlCAbKOq6kKDtddNu03VQhXfPMsDNqAZu J1QPmnooITM961hepNHKsvCS4_TT60T3Z3EFAST05mMHQaRmNOcbe9O4ZZmVLcRoY0ZDLlF4V0du knPUuvZmdDCzX_6FFbCnMkjhB2yM93OOgFJ7u9uFkVsUoDg4UTLQAmlLKf5YMlXijevJNYRsNqQ3 qe.LO4Rae9vMuelCLL5khOafKUGEoR_dqmvTUfKMxN0pL8Yz0KmAR7Mzd7aDHs3R5lfgEF.Z9GL. GDVVI6k_gOvLqjkiBmWvKpCNi54mnx1D7O1uYKYxfilfk3OrDFcymsyH7aBTfEQ2uYoHuHoPLH6X s1.3Qn4sHXNDjrgB1927IMx8htrZaRJzR82_MQ7q1Nfko4PPLzx7iBrJ0C2DnEAwv3V2_sL.jCm5 Y.trDhrHGX0eMQ_9HQAz0PxnZ4jzVGuuA4XLVosA6FJwZABGTpanO.p31anMEv5YW4FMO4VVR..S a7Tt2tyAR4AdKs_oSqpNoExEYfWp1Wt0V3Gt_tRtA.JT0yJC_zhS_.rjbMxRBsOqiR2N5gPfXEQc x.EZVNG7c8pVXCEh2t8TjT.VEq6aktTcCFJwQRo7tonWr0B.KJ12SkFce7xbyQNy.kwF.UCBsDKB oQz.j1QYFHoslsQ6xTAT5pV_js9TGUIdkMTKScnSOtHMw_E1uBcYuY_WpW5RFIgEgWOc6XEMZwvW S_IIpplRwa5hjnKXFuT_CyFBFyBjhem4FcsV0t6PNf X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Fri, 26 Feb 2021 11:15:16 +0000 Original-Received: by smtp405.mail.gq1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 52157cc25094aed236e29b3fbfc3fb6e; Fri, 26 Feb 2021 11:15:12 +0000 (UTC) In-Reply-To: <768f0a03350676677860ab874f79904a5acbe75b.camel@planete-kraus.eu> X-Mailer: WebService/1.1.17828 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.9.1) Received-SPF: pass client-ip=98.137.69.146; envelope-from=spk121@yahoo.com; helo=sonic310-20.consmr.mail.gq1.yahoo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17316 Archived-At: On Fri, 2021-02-26 at 10:33 +0100, Vivien Kraus via General Guile related discussions wrote: > Hello, >=20 > I=E2=80=99m trying to use a bytevector from C. >=20 > 1. According to an example in the manual, SCM_BYTEVECTOR_CONTENTS can > be assigned to a char*. >=20 > 2. Also from the manual, it is a signed char*. >=20 > 3. I've found this question online saying they are not compatible ( > https://stackoverflow.com/questions/12769500/why-is-char-not-compatible-w= ith-signed-char-or-unsigned-char > ). >=20 > As I understand it, at least one of the above 3 affirmations is > incorrect. Could someone clarify this to me? Depending on your compiler and OS, char is either signed char (-128 to 127) or unsigned char (0 to 255). It is probably signed char. You are free to cast the contents of a bytevector as signed char *, unsigned char *, or char * (which is probably signed char). It depends on what you want. When you use a bytevector from within Guile, it will appear as unsigned 8=3Dbit integers. But from within guile you could use bytevector-s8-ref if you wanted to pull a byte out as a signed 8- bit integer. -Mike