[LHC] [GaroaHC] Re: Ainda sobre memória do Arduino, evitando o "new"

Alejandro Mesias ale.mesias at gmail.com
Thu Feb 25 11:05:48 PST 2016


@Leandro, tenho uma fábrica desta forma, onde o método é estático e todas
as classes que chamo o comando new extendem de EepromReaderBase. Neste caso
acredito que seja difícil manter a fábrica se tirar o new da jogada:


EepromReaderBase * EepromReaderBase::getReaderBase(byte eeprom_type){
EepromReaderBase * p;
byte p_type =
pgm_read_byte(&(protocol_configs[eeprom_type][PROTOCOL_TYPE]));
if (p_type == PROTOCOL_SPI_TYPE){
p =  new SPIEepromReader(eeprom_type);
} else if(p_type == PROTOCOL_MW_TYPE){
p = new MicroWireEepromReader(eeprom_type);
} else if(p_type == PROTOCOL_IIC_TYPE){
p = new I2cEepromReader(eeprom_type);
} else {
p = NULL;
}
return p;
}

Em 24 de fevereiro de 2016 09:51, DQ <dqsoft.blogspot at gmail.com> escreveu:

> https://isocpp.org/wiki/faq/dtors
>
> DQ
>
> On Tuesday, February 23, 2016 at 4:28:28 PM UTC-3, Mesias wrote:
>>
>> Minha dúvida é se ele vai chamar o destrutor, não apenas se vai destruir
>> :D
>> Que preciso que execute o destrutor, claro que é rápido testar isso.
>>
>> Se vai executar o:  o1.~Objeto()   ou o instancia.~Blarg();
>>
>>
>>
>> --
> -... . . -..- -.-. . .-.. .-.. . -. - - --- . .- -.-. .... --- - .... . .-.
> Regras da Lista: https://garoa.net.br/wiki/Lista:LeiaAntesDeClicarNoSend
> Para mais informações sobre o Garoa Hacker Clube acesse
> https://garoa.net.br
> Maiores opções sobre o Google Groups, visite:
> https://groups.google.com/group/hackerspacesp
> .--. .- .-. .- -- .- .. ... .. -. ..-. --- .-. -- .- . ... .- -.-. . ...
> ... . --- .-- .. -.- ..
> Epoch 0 <=> Fundação: 1298244863 s ~ 2.408064*10^52 tP (tempos de Planck)
>



-- 
======================================
Alejandro Mesias André Nebra Perez
Java/Python/Js/Something else Developer
Twitter: @meszias
Linux User #442506
Campinas - SP - Brasil - South America
======================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.tia.mat.br/pipermail/hsc-tia.mat.br/attachments/20160225/6c912281/attachment-0001.html>


More information about the HSC mailing list