X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DC31384DB73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1699886332; bh=gA9BMbLOyDb5HFS7hrdvUM0qWrZ2BnM+PT4sGvuKrc8=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jZPZoYseDP0qN/mPT9i07sI9dzv6xqaWOUFJ0rGGUbtiG0QPXVUyNAvoujbcyimlr DS8hGixtK/ekVKg7mHvILenorl57iiYBHfYbx+oLo9C8n27ONRIGbCoQAI4hockbdW ogt5Cth+XAf9PpCh1SJoyUxdcBoH+TKYLczNpzoM= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1AD833858C20 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1AD833858C20 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699886317; cv=none; b=XMuHFNGzajZ2RnNucBuzJyCyoZyYAHheOHjQ5BWYRBEJMEQTj/WHdSnlmSv0Y38xj1BadKeMDT7B5aq9LrwE2FCWlMEoQEtp1D+vQTOZiXfoTZDBehg3zInCz2oYdgG1cYEMWE6opUYkVNuSNm6YY4vPIv9fPtN39JpUxU9CgTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699886317; c=relaxed/simple; bh=5ctRuvBPNdPEprW4+glcyCjBDkFHiXoLQrBZyDAZtzo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=WRVokK23cNMVrz+oEXFwO7owOnW9+nLigvmqwHbS38GFRaye+td995zEmO9JhymA3HLIVDrenK5UNXQVbKOqkyl4HOYsMlwJ77rfOuvWEY0UxYHYGy0RlXcSFGr/GGFFiRY90Yozq3b6M73TRyxZWErEXPZgDKNrpr4K6hVVMMI= ARC-Authentication-Results: i=1; server2.sourceware.org X-MC-Unique: 5kBQaR1MM2CvVUs4KvMgog-1 Date: Mon, 13 Nov 2023 15:38:32 +0100 To: Bruno Haible Subject: Re: rand is not ISO C compliant in Cygwin Message-ID: Mail-Followup-To: Bruno Haible , newlib AT sourceware DOT org, cygwin AT cygwin DOT com References: <9938355 DOT c9vzh5UkMf AT nimes> <4746602 DOT Hd9D3QOfv1 AT nimes> MIME-Version: 1.0 In-Reply-To: <4746602.Hd9D3QOfv1@nimes> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: newlib AT sourceware DOT org Cc: Corinna Vinschen , newlib AT sourceware DOT org, cygwin AT cygwin DOT com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Nov 13 15:25, Bruno Haible wrote: > Corinna Vinschen wrote: > > The rand() function would still not use locking but AFAICS that's > > not actually required by POSIX or ISO C. > > Correct. Those who want an MT-safe rand-like function need to use random(), > not rand(). FTR, we have to differ here between plain newlib targets and Cygwin. While Cygwin comes with it's own, table-based random() implementation taken from BSD back in 2007, newlib's random is basically equivalent to rand() for the sake of bare-metal and other targets with high memory pressure. We shouldn't change the latter since multi-threading compliance is usually not much of a problem for that target audience. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple