#define is a 'preprocessor', it simply does a text substitution.
Your first case becomes:
Reminder r1 = {true, 3;, 1,...
The semicolon is illegal. Change your define to:
#define kDBDays (3)
And it should work.
Good Luck,
-jjf
-----Original Message-----
From: Sean McMains [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 24, 2001 4:11 PM
To: [EMAIL PROTECTED]
Subject: Constants in C
Hi Folks,
I'm new to Palm development, and have been working through the O'Reilly
book. So far, it's a great deal of fun mixed with a great deal of
frustration. :)
The question de jour:
Why would this not compile (illegal initialization, expression syntax
error):
Reminder r1 = {true, kDBDays, 1, 0, 0, kDBCalendar, false, "1 Day
Video", "Video Rental Due"};
But this does:
Reminder r1 = {true, 3, 1, 0, 0, 1, false, "1 Day Video", "Video Rental
Due"};
The definitions:
#define kDBMinutes 1;
#define kDBHours 2;
#define kDBDays 3;
#define kDBWeeks 4;
#define kDBMonths 5;
#define kDBYears 6;
#define kDBCalendar 1;
#define kDBTodoList 2;
typedef struct {
Boolean fixedNumOfDays;
UInt8 unitType;
UInt16 numUnits;
UInt8 ordinal;
UInt8 dayOfWeek;
UInt8 insertInto;
Boolean useTimeOfDay;
const Char *buttonText;
const Char *reminderText;
} Reminder;
I expect this is some arcane C issue, but I've been away from the
language long enough that it's not coming to me.
Thanks in advance for any help!
Sean McMains
------
Sean McMains ([EMAIL PROTECTED])
AIM: SeanMcTex
http://www.mcmains.net/ruminations/
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/