delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/24/13:58:10

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=BAYES_20
X-Spam-Check-By: sourceware.org
Date: Mon, 24 Aug 2009 10:57:23 -0700
From: Keith Thompson <kst AT mib DOT org>
To: cygwin AT cygwin DOT com
Cc: Keith Thompson <kst AT mib DOT org>
Subject: Error in memset man page
Message-ID: <20090824175723.GA1245@nuthaus.mib.org>
MIME-Version: 1.0
User-Agent: Mutt/1.5.19 (2009-01-05)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

"man memset" shows the following synopsis for the memset function:

    #include <string.h>
    void *memset(const void *DST, int C, size_t LENGTH);

The "const" on the first parameter is incorrect.  The correct
prototype according to the C standard (both C90 and C99) is:

    void *memset(void *s, int c, size_t n);

(The differing parameter names are ok.)

The problem is only in the documentation; the actual declaration
doesn't have the const:

    % echo '#include <string.h>' | gcc -E - | grep memset
    void * __attribute__((__cdecl__)) memset (void *, int, size_t);

This was found by a poster on comp.lang.c calling himself
"Noob <root AT 127 DOT 0 DOT 0 DOT 1>".

-- 
Keith Thompson (The_Other_Keith) kst AT mib DOT org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019