<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=4&amp;t=1429&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2012-08-17T19:10:35+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=1429&amp;mode</id>
<entry>
<author><name><![CDATA[sirk77]]></name></author>
<updated>2012-08-17T19:10:35+01:00</updated>
<published>2012-08-17T19:10:35+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=1429&amp;p=12926#p12926</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=1429&amp;p=12926#p12926"/>
<title type="html"><![CDATA[offsetof()]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=1429&amp;p=12926#p12926"><![CDATA[
potrzebuję użyć offsetof(makro z &lt;stddef.h&gt;) w makrze:<br /><br />[syntax=c]#include &lt;stddef.h&gt;<br />...<br />#define GetAddr(ptr, field) (void*)pgm_read_word(((uint8_t*)ptr)+ offsetof(struct _menuitem, field))<br />...<br />tmpmenuitem = GetAddr(tmpmenuitem, next);<br />...[/syntax]<br /><br />jednak wyrzuca błąd :&quot;syntax error&quot;<br />po za-skip-owaniu offsetof -&gt; wszystko jest OK<br />[syntax=c]#define GetAddr(ptr, field) (void*)pgm_read_word(((uint8_t*)ptr) /*+ offsetof(struct _menuitem, field)*/)[/syntax]<br /><br />jak wchodzę w bibliotekę &lt;stddef.h&gt; to wynika, że to makro jest wyłączone???<br />[syntax=c]#ifdef _STDDEF_H<br /><br />/* Offset of member MEMBER in a struct of type TYPE. */<br />#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)<br /><br />#endif /* _STDDEF_H was defined this time */[/syntax]<br />jak to ugryźć???<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=187">sirk77</a> — 17 sie 2012, o 19:10</p><hr />
]]></content>
</entry>
</feed>