X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B6803856973 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1699733953; bh=I5AYlhsgXltQqzJy+LiV80UKnMhnPlsi8pxCd3zx4yk=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=DpqFg/Vbn2I5QJLPCL6u3r4wItTaxQNlZs8EIyuNsBq/AoBlUYwnnVlkyEoFkVQGZ xG3j8FW6CweJmG2UwO2xwzbz1z3qpFQ3lHIkDX5kPUrZ/ATpElpBt5Ca7k6Umutrrc KrFxvJ7bJnxqFiivebrtI3ikqAUXvM8PO/N5bKjA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 208A93858D37 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 208A93858D37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699733918; cv=none; b=nu9EsFwr1nk6IfXW3ADlGkKhGgiwDIKLhApKGj1wvrKCbseC/GzP91F702RyAXNIMkTncsqEa8lMjx+nwAHwXLWeV0KWpmjrTJ7aPN37AxInnrc+8AD6mFu7nBLlXTN0rrQgc5bVDqT4odfQSVfUuRjQiMarxqyPfjZxzCINcTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699733918; c=relaxed/simple; bh=rG1nfuOV1zLSut8Oa0RIVpotuzeLgpNWN2vwMx41yC0=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=pRtPJ96NUPw6ao4KYvFxBN48UYCKjPBMEjGiOVmuOoaWvMUNzv7y4l1UnIVYQ/s8C+rh9cVO/SEuxDe3tsOl34s2GYsssLNmYe/s+CeEfm5PX/XgN3FS5dKT/1mnqQkenEzfTXKvIdLbGlazDQcqUMUQrtvx4CvEF+NuuRNyUiQ= ARC-Authentication-Results: i=1; server2.sourceware.org Message-ID: Date: Sat, 11 Nov 2023 15:18:37 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: rand is not ISO C compliant in Cygwin Content-Language: en-US To: =?UTF-8?Q?Ren=C3=A9_Berber?= , cygwin AT cygwin DOT com References: <9938355 DOT c9vzh5UkMf AT nimes> <5748524 DOT yeFs27NDWt AT nimes> In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, 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 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: "Allen, Norton T. via Cygwin" Reply-To: "Allen, Norton T." Content-Type: text/plain; charset="utf-8"; Format="flowed" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 3ABKJEqG010531 On 11/11/2023 1:25 PM, René Berber via Cygwin wrote: > On 11/11/2023 10:50 AM, Allen, Norton T. via Cygwin wrote: > > [snip] >>> The srand function is not required to avoid data races with other >>>     calls to pseudo-random sequence generation functions. ..." >> That is not the same as "... required never to avoid data races ...". >> "not required" means the sentence is not specifying--not >> requiring--any behavior, so you should not depend on the described >> behaviors. > [snip] > > The elided part on Bruno's message is: > > "The implementation shall behave as if no library function calls the > rand function." > > Which is the point Bruno is making with the sample code. I would still assert that if the implementation is doing what I suggested (maintaining independent state for each thread) it would still meet that criteria, although I admit it is debatable. That said, the man page says: "rand and srand are unsafe for multi-threaded applications. rand_r is thread-safe and should be used instead." I read that as "all bets are off" if you are using them in a multi-threaded application. -- 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