Deferring SoftwareSerial object creation

Appears there was a thread that references a "fix" for the "new" syntax, that was related to my question. So there are some differences in std implementation of C++.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1216134904

I fixed the second example (and used "new") by adding the following code at the top:

#include <stdlib.h>
/*
__extension__ typedef int __guard __attribute__((mode (__DI__)));

int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);};
void __cxa_guard_release (__guard *g) {*(char *)g = 1;};
void __cxa_guard_abort (__guard *) {}; 

*/

void * operator new(size_t size);
void operator delete(void * ptr);

void * operator new(size_t size)
{
  return malloc(size);
}

void operator delete(void * ptr)
{
  free(ptr);
}

The commented out code above was a part of the recommend code siplet but it wouldn't compile (error: '__guard' was not declared in this scope In function 'int __cxa_guard_acquire(__guard*)':slight_smile: and I did not need the functionality it gave.

Thanks for checking this one out.