<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/8724" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2013-11-14T23:22:54+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/8724</id>

		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2013-11-14T23:22:54+02:00</updated>

		<published>2013-11-14T23:22:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=8724&amp;p=26181#p26181</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=8724&amp;p=26181#p26181"/>
		<title type="html"><![CDATA[Re: schar and uchar macros in usbdrv.h]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=8724&amp;p=26181#p26181"><![CDATA[
You are, of course, right. V-USB has been developed for tiny projects originally, and it's easy to rename variables or avoid particular names in tiny projects. V-USB has grown from that, as you can see, and it would be time for a major cleanup.<br /><br />BTW: I usually don't have the time to read the forum, just discovered your postings because I was doing some administrative work here. If you have a feature request, please send it to our support, at least in copy.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Thu Nov 14, 2013 11:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[blargg]]></name></author>
		<updated>2013-11-14T22:34:21+02:00</updated>

		<published>2013-11-14T22:34:21+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=8724&amp;p=26178#p26178</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=8724&amp;p=26178#p26178"/>
		<title type="html"><![CDATA[schar and uchar macros in usbdrv.h]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=8724&amp;p=26178#p26178"><![CDATA[
Perhaps a minor issue, but I'd rather mention it than keep quiet. I am thrilled with V-USB so small things like this stand out more. I am also aware that there's a feedback channel, but I'd rather discuss this with other users rather than merely have it be a request.<br /><br />The schar and uchar macros can conflict with user code that uses those names for other things in a local scope. e.g.<br /><br /><div class="codebox"><p>Code: </p><pre><code>#include &quot;usbdrv.h&quot;<br /><br />void f( void )<br />{<br />    int schar = 123; // error: two or more data types in declaration specifiers<br />}</code></pre></div><br /><br />If they were typedefs, this would be fine:<br /><br /><div class="codebox"><p>Code: </p><pre><code>typedef signed char schar;<br /><br />void f( void )<br />{<br />    int schar = 123; // no error<br />}</code></pre></div><br /><br />I realize that the macro might serve a second purpose: to avoid a duplicate typedef in case someone else has also defined schar:<br /><br /><div class="codebox"><p>Code: </p><pre><code>// other.h<br />#define schar signed char<br /><br />// usbdrv.h<br />#ifndef schar // no problem, already defined so this is skipped<br />#define schar signed char<br />#endif</code></pre></div><br /><br />This serves the same purpose but doesn't conflict with user code using the name locally:<br /><br /><div class="codebox"><p>Code: </p><pre><code>#ifndef schar<br />#define schar schar<br />typedef signed char schar;<br />#endif<br /><br />void f( void )<br />{<br />    int schar = 123; // no error<br />}</code></pre></div><br /><br />Ideally a library's header file only defines things needed by the user, and doesn't introduce things like schar and uchar into the global space at all, especially as macros, them being lowercase. Things for the implementer's convenience ideally have the library's prefix in their names.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=20076">blargg</a> — Thu Nov 14, 2013 10:34 pm</p><hr />
]]></content>
	</entry>
	</feed>
