caramoan tour package

caramoan tour package

Author Topic: C Macros / Libraries / Tips and Tricks  (Read 2578 times)

Offline rdpzycho

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 10728
  • Pogi/Ganda Points: 632
  • Gender: Male
  • Respect Begets Respect
    • rdpzycho
Re: C Macros / Libraries / Tips and Tricks
« Reply #20 on: March 11, 2010, 06:14:14 PM »
sis rdp, gumagana yung idea mo! ;D ;D ;D

Code: [Select]
#include <iostream>
using namespace std;

void myfunc()
{
cout << "Hello Garci" <<endl;   
}



typedef struct
{
    void (*ptr)();
}Testing;



int main()
{
Testing mytest={myfunc};
mytest.ptr(); // call the function!
system("pause");
return 0;
}

output:
Code: [Select]
Hello Garci
Press any key to continue . . .

Hello Garci... :D

hindi ko idea talaga 'yan sis. nakita ko lang din sa ibang libraries ('di ko pinapansin dati pero nung nakita ko sa lwIP saka ko naisip na magmumukha nga siyang class). ;D gusto ko rin sanang i-adapt para mukhang pseudo-class 'yung sa C. hehe.

'yung sa lwIP kasi pinagsama niya sa isang structure lahat halimbawa para sa interface, kasama na rin 'yung functions para kausapin 'yung interface. mas madaling intindihin. ;D

‎"Divide each difficulty into as many parts as is feasible and necessary to resolve it."
- Rene Descartes

"For every difficult problem there is always a simple answer and most of them are wrong."
- Clayton Paul

Philippine Electronics Forum

Re: C Macros / Libraries / Tips and Tricks
« Reply #20 on: March 11, 2010, 06:14:14 PM »

Offline rdpzycho

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 10728
  • Pogi/Ganda Points: 632
  • Gender: Male
  • Respect Begets Respect
    • rdpzycho
Re: C Macros / Libraries / Tips and Tricks
« Reply #21 on: March 11, 2010, 08:07:08 PM »
isama ko na rin dito 'yung multiple button debounce routine ko. modified galing sa article ni Ganssle, inalis 'yung array.

Code: [Select]
/* put this code in a regular timer interval */
if (keyTestIndex < 25) /* 50ms on 2ms system tick interval */
  {
    keyTest &= keyPress;
    keyTestIndex++;
  }
  else
  {
    keyStatus = ~keyTest;
    keyTest = 0xff;
    keyTestIndex = 0;
    keyUpdate = 1;
  }
‎"Divide each difficulty into as many parts as is feasible and necessary to resolve it."
- Rene Descartes

"For every difficult problem there is always a simple answer and most of them are wrong."
- Clayton Paul

Philippine Electronics Forum

Re: C Macros / Libraries / Tips and Tricks
« Reply #21 on: March 11, 2010, 08:07:08 PM »

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6129
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: C Macros / Libraries / Tips and Tricks
« Reply #22 on: March 13, 2010, 02:54:56 PM »
Hello Garci... :D

hindi ko idea talaga 'yan sis. nakita ko lang din sa ibang libraries ('di ko pinapansin dati pero nung nakita ko sa lwIP saka ko naisip na magmumukha nga siyang class). ;D gusto ko rin sanang i-adapt para mukhang pseudo-class 'yung sa C. hehe.

'yung sa lwIP kasi pinagsama niya sa isang structure lahat halimbawa para sa interface, kasama na rin 'yung functions para kausapin 'yung interface. mas madaling intindihin. ;D



bakit nga ba di ko naisip yan dati? hehehehe... gggrrr ;D at least kahit papano alam na natin na pwede na mag encapsulate ng methods sa C sa loob ng struct. VERY NICE! ;D
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Philippine Electronics Forum

Re: C Macros / Libraries / Tips and Tricks
« Reply #22 on: March 13, 2010, 02:54:56 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com