<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[MISRA Discussion Forums - 4.21 Language support library]]></title>
		<link>https://forum.misra.org.uk/</link>
		<description><![CDATA[MISRA Discussion Forums - https://forum.misra.org.uk]]></description>
		<pubDate>Thu, 05 Nov 2026 15:13:59 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[21.2.2 Why shall std::strerror not be used?]]></title>
			<link>https://forum.misra.org.uk/showthread.php?tid=1736</link>
			<pubDate>Tue, 13 May 2025 18:26:44 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.misra.org.uk/member.php?action=profile&uid=5614">cgpzs</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.misra.org.uk/showthread.php?tid=1736</guid>
			<description><![CDATA[The rationale of the rule says:<br />
<br />
&gt; Also, some string handling functions only report errors through the use of errno<br />
<br />
But that't not the case for std:: strerror, it does not report any errors through errno, nor is it possible for it to "read beyond the bounds of an object passed as a parameter", so it's perfectly safe to use it.<br />
<br />
An alternative is to use std::make_error_condition(static_cast&lt;std::errc&gt;(errno)).message(), but it seems like overkill just to achieve the same thing, making the code far less readable.<br />
<br />
It's also worth noting that MISRA does not ban the usage of errno (besides the restriction from 22.4.1), which is required for using POSIX functions that don't have any equivalent in the Standard Library.<br />
<br />
Would you agree?]]></description>
			<content:encoded><![CDATA[The rationale of the rule says:<br />
<br />
&gt; Also, some string handling functions only report errors through the use of errno<br />
<br />
But that't not the case for std:: strerror, it does not report any errors through errno, nor is it possible for it to "read beyond the bounds of an object passed as a parameter", so it's perfectly safe to use it.<br />
<br />
An alternative is to use std::make_error_condition(static_cast&lt;std::errc&gt;(errno)).message(), but it seems like overkill just to achieve the same thing, making the code far less readable.<br />
<br />
It's also worth noting that MISRA does not ban the usage of errno (besides the restriction from 22.4.1), which is required for using POSIX functions that don't have any equivalent in the Standard Library.<br />
<br />
Would you agree?]]></content:encoded>
		</item>
	</channel>
</rss>