From patchwork Fri Oct 2 09:43:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 40631 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ECEF9388EC3E; Fri, 2 Oct 2020 09:44:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECEF9388EC3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601631880; bh=ctBjra5BgJEgRcesJor017cXG+iy3ZaHuadjYJsluL0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=htOfB2Mp/suCKOEaZ2k9mxdc0W/RchqlTduSsOcuxwE4QsMyBAww00/CyLJPDY2BP NrYSMWKDJl37elmYYuc9fk26JhPFTFnwnwW0CLadBVIsJ3TcECftaYQ3rOmb+haN32 aA6eShkn2km9j9tLC+ybhJ5QctlsuahcS2XyhzSE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by sourceware.org (Postfix) with ESMTPS id 3AEEF386F45F for ; Fri, 2 Oct 2020 09:44:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3AEEF386F45F Received: by mail-wm1-x343.google.com with SMTP id d4so973095wmd.5 for ; Fri, 02 Oct 2020 02:44:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ctBjra5BgJEgRcesJor017cXG+iy3ZaHuadjYJsluL0=; b=huNIumcZdUbcOtPc1wv6RHKd/mA+9loOL0ES3H188P1xxFVfJOlWZBYrlWZ7Xpyb04 HnxChJRwQqa1iPIdJTJ9RrtivEDcj6RyhJiyKrVtggLCStrbNMbwrzSkJqLWZooyjgyf wzqL3bhHRn/5z+LcGC1ZkEUjdjkIRBZ+UvXuCrxj9EDfzZVIKJKD+xuRTmH5D1E0jFyz bGVuL5Gwg45icE6LAWxqSyw/Aqn8WXokNFV4E1xcwoJCtJtmiFLTbxtakH+chzHf7yqu p8E59JmLbTJpJrwzJ9g0bmrjXUgX+opmuK1R+AC5wRRWP1d3X7LSwmUMHgA4BlwqT614 njFg== X-Gm-Message-State: AOAM532r8TGDYN7IBsIHtbVzL9AGAKjhTQBUPgQRUdM4WETuL6DAbKP1 xisoUVyc/2XXZtbEr+eKHNk= X-Google-Smtp-Source: ABdhPJxAJlbKc4+NHc6gcTuByOz0Y8QbGfjUTOT/ojCYE2TGIWIvX77hAYZO95tNrMRtNmwWW53mRg== X-Received: by 2002:a1c:6341:: with SMTP id x62mr1901135wmb.70.1601631876171; Fri, 02 Oct 2020 02:44:36 -0700 (PDT) Received: from localhost.localdomain ([170.253.60.68]) by smtp.googlemail.com with ESMTPSA id 70sm1236745wme.15.2020.10.02.02.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2020 02:44:35 -0700 (PDT) To: mtk.manpages@gmail.com, eggert@cs.ucla.edu, David.Laight@ACULAB.COM Subject: [PATCH] system_data_types.7: void *: Add info about generic function parameters and return value Date: Fri, 2 Oct 2020 11:43:16 +0200 Message-Id: <20201002094315.17832-1-colomar.6.4.3@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alejandro Colomar via Libc-alpha From: Alejandro Colomar Reply-To: Alejandro Colomar Cc: Alejandro Colomar , linux-man@vger.kernel.org, libc-alpha@sourceware.org, gcc-patches@gcc.gnu.org, linux-kernel@vger.kernel.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Reported-by: Paul Eggert Reported-by: David Laight Signed-off-by: Alejandro Colomar --- Paul and David, Thanks for your input! Alex man7/system_data_types.7 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/man7/system_data_types.7 b/man7/system_data_types.7 index aab64e002..6451782db 100644 --- a/man7/system_data_types.7 +++ b/man7/system_data_types.7 @@ -1903,6 +1903,16 @@ and back. .PP Conversions from and to any other pointer type are done implicitly, not requiring casts at all. +Note that this feature prevents any kind of type checking: +the programmer should be careful not to cast a +.I void * +value to a type incompatible to that of the underlying data, +because that would result in undefined behavior. +.PP +This type is useful in function parameters and return value +to allow passing values of any type. +The function will usually use some mechanism to know +of which type the underlying data passed to the function really is. .PP A value of this type can't be dereferenced, as it would give a value of type @@ -1926,6 +1936,12 @@ values. Conforming to: C99 and later; POSIX.1-2001 and later. .PP +See also: +.BR malloc (3), +.BR memcmp (3), +.BR memcpy (3), +.BR memset (3) +.PP See also the .I intptr_t and