<?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=5984&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-02-19T11:59:09+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=5984&amp;mode</id>
<entry>
<author><name><![CDATA[xor]]></name></author>
<updated>2014-02-19T11:59:09+01:00</updated>
<published>2014-02-19T11:59:09+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71098#p71098</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71098#p71098"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71098#p71098"><![CDATA[
&quot;Deklaracja&quot;, &quot;definicja&quot; te pojęcia często się mieszają chociaż ich znaczenie jest istotnie różne. Sam trochę zamieszałem więc może zacznijmy od początku. <br /><br />Deklaracja struktury to opis co tam się wewnątrz znajduje:<br /><br />[syntax=c]struct bla_struct {<br />   int inner_bla_int;<br />   char inner_bla_char;<br />    };[/syntax]<br /><br />Definicja struktury to powołanie do istnienia zmiennej strukturalnej:<br /><br />[syntax=c]struct bla_struct bla_var;[/syntax]<br /><br />Można to połączyć i jednocześnie strukturę zadeklarować i zdefiniować:<br /><br />[syntax=c]struct bla_struct {<br />   int inner_bla_int;<br />   char inner_bla_char;<br />    } bla_var;[/syntax]<br /><br />I teraz wracając do twoich zmagań - nie możesz inicjować struktury w deklaracji, możesz inicjować przy definicji. A więc to nie jest prawidłowe:<br /><br />[syntax=c]struct bla_struct {<br />   int inner_bla_int;<br />   char inner_bla_char = 'a';<br />    };[/syntax]<br /><br />ani to: <br /><br />[syntax=c]struct bla_struct {<br />   int inner_bla_int;<br />   char inner_bla_char = 'a';<br />    } bla_var;[/syntax]<br /><br />prawidłowe jest to:<br /><br />[syntax=c]struct bla_struct {<br />   int inner_bla_int;<br />   char inner_bla_char;<br />    } bla_var = { 0, 'a' );[/syntax]<br /><br />albo to:<br /><br /><br />[syntax=c]struct bla_struct {<br />   int inner_bla_int;<br />   char inner_bla_char;<br />    };<br /><br />struct bla_struct bla_var = { 0, 'a' );[/syntax]<br /><br />Modyfikatory 'const' czy 'typedef' nie wnoszą nic nowego do tej zasady. Jedynie w razie zadeklarowania (albo zdefiniowania) całej (lub części) struktury jako const kompilator sprawdza czy w kodzie nie ma przypisań do zmiennej (za wyjątkiem inicjalizacji oczywiście). <br />To tyle. A teraz powiedz co włąściwie chcesz uzyskać?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1774">xor</a> — 19 lut 2014, o 11:59</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kurnachatka]]></name></author>
<updated>2014-02-19T08:59:50+01:00</updated>
<published>2014-02-19T08:59:50+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71078#p71078</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71078#p71078"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71078#p71078"><![CDATA[
Spróbuj tak:<br />[syntax=c]typedef struct {<br />         uint16_t const1;   //przykladowe constanty<br />         uint16_t const2;<br />         uint16_t const3;<br />        }tab_const;<br />     <br />    const tab_const tab_Of_Const = {5,4,3};[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=930">kurnachatka</a> — 19 lut 2014, o 08:59</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Anonymous]]></name></author>
<updated>2014-02-19T08:42:35+01:00</updated>
<published>2014-02-19T08:42:35+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71076#p71076</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71076#p71076"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71076#p71076"><![CDATA[
W definicji struktury używasz rozdzielania składników znakiem cudzysłów ; znowu przy deklaracji (inicjacji wartościami) używasz już rozdzielania przecinkami.<br />(mam nadzieje że dobrze użyłem tych słów definicja/deklaracja)<br /><br />Przykład<br /><br />[syntax=c]// struktura z konfiguracją IP i wifi<br />typedef struct {<br />char *ip_wizfi;<br />char *essid;<br />char *wpapsk;<br />char *nauto;<br />} TCFG;<br /><br />const TCFG pgm_WizFicfg PROGMEM = {<br />IP_WIZFI,        // Adres IP modułu WizFi<br />ESSID,// Essid APka<br />WPAPSK,// Klucz WPAPSK2 do APka<br />NAUTO// Type, Protocol, Destonation, port<br />};[/syntax]<br /><br />Gdzie IP_WIZFI, ESSID, WPAPSK, NAUTO to są stałe zdefiniowane za pomocą #define<p>Statystyki: Napisane przez Gość — 19 lut 2014, o 08:42</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kiclaw]]></name></author>
<updated>2014-02-19T08:27:07+01:00</updated>
<published>2014-02-19T08:27:07+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71074#p71074</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71074#p71074"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71074#p71074"><![CDATA[
No OK, tylko że w chwili gdy zrobię coś takiego:<br /><br />[syntax=c]typedef struct tab_const{<br />     uint16 const1;   //przykladowe constanty<br />     uint16 const2;<br />     uint16 const3;<br />    }tabOfConst;<br />     <br />   // const tabOfConst tab_Of_Const = {5,4,3}; //przykladowe constanty<br />     <br />    //typedef struct tab_Of_Const tableOfconst;<br />     <br />    struct nowa_struktura<br />    {<br />      const tabOfConst tab_Of_Const = {5,4,3}; //blad<br />    };[/syntax]<br /><br />to wyrzuca mi taki błąd: <strong>expected ':', ',', ';', '}' or '__attribute__' before '=' token</strong><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=600">kiclaw</a> — 19 lut 2014, o 08:27</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[xor]]></name></author>
<updated>2014-02-18T18:23:32+01:00</updated>
<published>2014-02-18T18:23:32+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71010#p71010</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71010#p71010"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=71010#p71010"><![CDATA[
<div class="quotetitle">kiclaw napisał(a):</div><div class="quotecontent"><br />Wydaje mi się że definiuję ją w właśnie 10 wierszu.<br /></div><br />Nie, w wierszu 10 definiujesz tylko nowy typ danych o nazwie &quot;tableOfconst&quot;, który jest aliasem do &quot;struct tab_Of_Const&quot;. Struktura &quot;tab_Of_Const&quot; pozostaje niezdefiniowana. Może Tobie się wydaję, że zdefinowałeś ją w wierszu 7, ale nie, to jest z kolei definicja zmiennej &quot;tab_Of_Const&quot; typu &quot;tabOfConst&quot;. Jak widać zmienna i typ strukturalny mogą nazywać się tak samo a być czymś całkiem innym.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1774">xor</a> — 18 lut 2014, o 18:23</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kiclaw]]></name></author>
<updated>2014-02-18T16:09:25+01:00</updated>
<published>2014-02-18T16:09:25+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70996#p70996</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70996#p70996"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70996#p70996"><![CDATA[
Co do nawiasów to są OK, musiał się wkraść błąd do samego listningu. No OK to jak zdefiniować tę strukturkę? Wydaje mi się że definiuję ją w właśnie 10 wierszu. Czyli powołuję strukturkę &quot;tableOfconst&quot; która jest typu &quot;tab_Of_Const&quot;<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=600">kiclaw</a> — 18 lut 2014, o 16:09</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[xor]]></name></author>
<updated>2014-02-18T15:08:24+01:00</updated>
<published>2014-02-18T15:08:24+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70993#p70993</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70993#p70993"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70993#p70993"><![CDATA[
To nie wiersz 15 jest problematyczny tylko 10. Podany zapis byłby prawidłowy gdyby struktura &quot;tab_0f_Const&quot; była uprzednio zdefiniowana, a tak nie jest.<br />Zresztą cały ten listing jest problematyczny bo w nawiasach klamrowych jest kaszana.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1774">xor</a> — 18 lut 2014, o 15:08</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kiclaw]]></name></author>
<updated>2014-02-18T16:14:09+01:00</updated>
<published>2014-02-18T13:48:11+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70987#p70987</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70987#p70987"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70987#p70987"><![CDATA[
No ok, mam kod jak poniżej (chce zrobić następny poziom struktury) i mam error: field 'tablica' has incomplete type<br /><br />[syntax=c]typedef struct tab_const{<br /> uint16 const1;   //przykladowe constanty<br /> uint16 const2;<br /> uint16 const3;<br />}tabOfConst;<br /><br />const tabOfConst tab_Of_Const = {5,4,3}; //przykladowe constanty<br /><br />typedef struct tab_Of_Const tableOfconst;<br /><br />struct nowa_struktura<br />{<br />  tableOfconst tablica; //jak tutaj zdefiniowac ta strkturkę/ poniewz tutaj wywala blad<br />};[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=600">kiclaw</a> — 18 lut 2014, o 13:48</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[xor]]></name></author>
<updated>2014-02-13T14:04:15+01:00</updated>
<published>2014-02-13T14:04:15+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70273#p70273</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70273#p70273"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70273#p70273"><![CDATA[
Po pierwsze: jaki błąd? podaje się konkretny komunikat błędu, a nie &quot;jakiś błąd&quot;<br /><br />Po drugie to nie zadziała:<br /><div class="quotetitle">kiclaw napisał(a):</div><div class="quotecontent"><br />struct test{<br /> <br />   const uint16 testowyConst = 1234;<br />};<br /></div><br /><br />pisze się to tak jakoś tak:<br /><br />[syntax=c]struct test{<br /> <br />   const uint16 testowyConst;<br />} taka_sobie_stala_zmienna = { 1234};[/syntax]<br /><br />albo tak: <br /><br />[syntax=c]typedef struct TEST{<br /> uint16 testowa;<br />};<br />const TEST test = {5};[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1774">xor</a> — 13 lut 2014, o 14:04</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-02-13T13:57:40+01:00</updated>
<published>2014-02-13T13:57:40+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70272#p70272</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70272#p70272"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70272#p70272"><![CDATA[
<div class="quotetitle">kiclaw napisał(a):</div><div class="quotecontent"><br />A można w ogóle robić tak? (przypisać wartości w struct)<br />[syntax=c]struct test{<br /> uint8 testowa=123;<br />};[/syntax]<br /></div><br /><br />hmmm a poczytałeś to co pdodałem w LINKU wyżej <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /><br /><br />na prawdę tam właśnie OD MEGA PODSTAW opisałem co i jak ze strukturami w C i masz tam odpowiedzi na swoje pytania, nie będziesz musiał zgadywać czy można tak czy siak jak to przeczytasz  ok ?<br /><br />chyba że czegoś tam nie zrozumiesz to dopytaj proszę ok ? bo ciężko mi teraz drugi raz to samo tutaj przepisywać jakby<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 13 lut 2014, o 13:57</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kiclaw]]></name></author>
<updated>2014-02-13T13:28:02+01:00</updated>
<published>2014-02-13T13:28:02+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70263#p70263</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70263#p70263"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70263#p70263"><![CDATA[
A można w ogóle robić tak? (przypisać wartości w struct)<br />[syntax=c]struct test{<br /> uint8 testowa=123;<br />};[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=600">kiclaw</a> — 13 lut 2014, o 13:28</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-02-13T13:13:59+01:00</updated>
<published>2014-02-13T13:13:59+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70260#p70260</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70260#p70260"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70260#p70260"><![CDATA[
a kolega zagląda na mój blog do poradników ?<br /><br />oooj chyba nie za często <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /><br /><br /><!-- m --><a class="postlink" href="http://mirekk36.blogspot.com/2013/07/struktury-w-c-wyjasnijmy-sobie-dokadnie.html" >http://mirekk36.blogspot.com/2013/07/st ... adnie.html</a><!-- m --><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 13 lut 2014, o 13:13</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kiclaw]]></name></author>
<updated>2014-02-13T13:12:38+01:00</updated>
<published>2014-02-13T13:12:38+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70259#p70259</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70259#p70259"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70259#p70259"><![CDATA[
[syntax=c]typedef struct TEST{<br /> uint16 testowa = 5;<br />};<br /><br />const TEST test;[/syntax]<br /><br />Gdzieś tu jest babol <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=600">kiclaw</a> — 13 lut 2014, o 13:12</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-02-13T13:05:50+01:00</updated>
<published>2014-02-13T13:05:50+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70256#p70256</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70256#p70256"/>
<title type="html"><![CDATA[Re: const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70256#p70256"><![CDATA[
typedef i najpierw definicja struktury o nazwie np TEST , a potem stworzenie zmiennej const<br /><br />[syntax=c]const TEST test;[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 13 lut 2014, o 13:05</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kiclaw]]></name></author>
<updated>2014-02-13T12:45:07+01:00</updated>
<published>2014-02-13T12:45:07+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70244#p70244</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70244#p70244"/>
<title type="html"><![CDATA[const w strukturze]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=5984&amp;p=70244#p70244"><![CDATA[
Mam takie pytanko, jak zrobić strukturkę constantów?<br /><br />Przy takim czymś wywala mi błąd:<br /><br />[syntax=c]struct test{<br /><br />   const uint16 testowyConst = 1234;<br />};[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=600">kiclaw</a> — 13 lut 2014, o 12:45</p><hr />
]]></content>
</entry>
</feed>