Conditional compilation fails

OK, PaulS... this is what you wanted... don't blame me for the size of the post...

#include <EEPROM.h>
#undef INIT
#define EPROM 1024

#define USECHAR
#ifdef USECHAR
#define TYPE char
#else
#define TYPE long
#endif

#define USECONST
#ifdef USECONST
const TYPE KEYA =  1;   
#else
#define KEYA ((TYPE) 1)   
#endif
boolean v;

int freeRam() {
  extern int __bss_end; // == extern unsigned int __heap_start;
  extern void * __brkval;
  int freememory;
  freememory = ((int)&freememory) - (((int)__brkval == 0)? ((int)&__bss_end): ((int)__brkval));
  return freememory;
}
unsigned long sketchSize(void) {
  extern int _etext;
  extern int _edata;
  return ((unsigned long)(&_etext) + ((unsigned long)(&_edata) - 256L));
}
void setup() {
  Serial.begin(9600);
  TYPE tt = random();
  boolean w = true;
  v = tt == KEYA;
  w = w && v;
  Serial.print("using ");
  #ifdef USECHAR
  Serial.print("char ");
  #else
  Serial.print("long ");
  #endif
  #ifdef USECONST
  Serial.print("constants");
  #else
  Serial.print("definitions");
  #endif
  Serial.print(", sketchsize "); Serial.print(sketchSize());
  Serial.print(", freeram ");Serial.println(freeRam());
  Serial.println(w);
}

void loop() {
  ;
}

This generates the following compiler output...

avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=101 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/EEPROM /tmp/build3179014252548270902.tmp/eepromtest.cpp -o /tmp/build3179014252548270902.tmp/eepromtest.cpp.o 
  Using previously compiled: /tmp/build3179014252548270902.tmp/EEPROM/EEPROM.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/wiring_pulse.c.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/wiring_analog.c.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/WInterrupts.c.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/wiring_digital.c.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/wiring.c.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/wiring_shift.c.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/HID.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/WString.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/main.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/Stream.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/Tone.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/HardwareSerial.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/Print.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/IPAddress.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/new.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/CDC.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/WMath.cpp.o
  Using previously compiled: /tmp/build3179014252548270902.tmp/USBCore.cpp.o
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/wiring_pulse.c.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/wiring_analog.c.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/WInterrupts.c.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/wiring_digital.c.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/wiring.c.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/wiring_shift.c.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/HID.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/WString.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/main.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/Stream.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/Tone.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/HardwareSerial.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/Print.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/IPAddress.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/new.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/CDC.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/WMath.cpp.o 
avr-ar rcs /tmp/build3179014252548270902.tmp/core.a /tmp/build3179014252548270902.tmp/USBCore.cpp.o 
avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build3179014252548270902.tmp/eepromtest.cpp.elf /tmp/build3179014252548270902.tmp/eepromtest.cpp.o /tmp/build3179014252548270902.tmp/EEPROM/EEPROM.cpp.o /tmp/build3179014252548270902.tmp/core.a -L/tmp/build3179014252548270902.tmp -lm 
avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/build3179014252548270902.tmp/eepromtest.cpp.elf /tmp/build3179014252548270902.tmp/eepromtest.cpp.eep 
avr-objcopy -O ihex -R .eeprom /tmp/build3179014252548270902.tmp/eepromtest.cpp.elf /tmp/build3179014252548270902.tmp/eepromtest.cpp.hex 
Binary sketch size: 3,006 bytes (of a 32,256 byte maximum)

undefining USECONST, as follows...

#undef USECONST
#ifdef USECONST
const TYPE KEYA =  1;   
#else
#define KEYA ((TYPE) 1)   
#endif

Generates the following error output ...

avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=101 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/EEPROM /tmp/build3179014252548270902.tmp/eepromtest.cpp -o /tmp/build3179014252548270902.tmp/eepromtest.cpp.o 
eepromtest.cpp:42:1: error: ‘boolean’ does not name a type
eepromtest.cpp: In function ‘void setup()’:
eepromtest.cpp:57:3: error: ‘Serial’ was not declared in this scope
eepromtest.cpp:58:20: error: ‘random’ was not declared in this scope
eepromtest.cpp:59:3: error: ‘boolean’ was not declared in this scope
eepromtest.cpp:59:11: error: expected ‘;’ before ‘w’
eepromtest.cpp:60:3: error: ‘v’ was not declared in this scope
eepromtest.cpp:61:3: error: ‘w’ was not declared in this scope

In case you're wondering about including EEPROM.h, that was when I was using the code for another purpose, but I left it in anyway.

Perhaps you now feel able to comment on the operation of the IDE, Version 1.0.1, by the way.

By the way, I am well aware that const and #define do different things... I wrote the code in order to discover just how different.