T.R | Title | User | Personal Name | Date | Lines |
---|
443.1 | Ultrix file also | HGOVC::KENBERKUN | Klaatu Barato Nikto | Tue Mar 21 1989 04:46 | 5 |
| I probably should have asked this one in the Ultrix file, I'll
cross post it there.
ken b.
|
443.2 | | AITG::DERAMO | Daniel V. {AITG,ZFC}:: D'Eramo | Tue Mar 21 1989 08:18 | 14 |
| The following two do not go together:
char *text;
and
DwtGetNextSegment(&dwContext,&text.filename,&charset,
--------------
You are taking [the address of] a structure reference off of
a char * variable.
Dan
|
443.3 | pcc is less forgiving than vcc | FLUME::dike | | Tue Mar 21 1989 08:38 | 10 |
| Listen to pcc. It knows what it's talking about. vcc will let a lot of highly
suspect contructs slip by that pcc won't. You found one of them. Others
include saying . when you mean -> and vice-versa and mixing of pointer types
are a couple more that come to mind.
In general, if your code compiles cleanly under pcc, it is portable and will
compile anywhere. Compiling it under vcc tells you relatively little about
how it will port.
Jeff
|
443.4 | use the compiler's options | CASEE::LACROIX | Gone with the wind | Tue Mar 21 1989 08:47 | 8 |
| Re .3:
Or use VAX C with /STANDARD=PORTABLE. It's very unlikely that PCC will
complain about something VAX C hasn't seen (with famous exceptions:
function prototypes, etc...).
Denis.
|
443.5 | Thanks | HGOVC::KENBERKUN | Klaatu Barato Nikto | Tue Mar 21 1989 20:12 | 5 |
| Thanks very much for all the replies. Moving my little application
to the MAX has been quite the lesson in portability.
Ken B.
|
443.6 | Uh... | HGOVC::KENBERKUN | Klaatu Barato Nikto | Wed Mar 22 1989 06:05 | 17 |
| OK, I never claimed to be a C guru...
I'm still not sure how I should declare text and then how I should
pass it to the routine. I tried
char *text; and passing it as text; &text; *text etc.
(the old brute force approach...) Some of these aren't accepted
by the compiler and some just don't work.
According to the manual it is expecting type **char and the routine
will automatically allocate the space.
Help. Thanks again.
ken_b_who_only_gets_to_write_code_late_at_night_please_have_mercy_on_me
|
443.7 | Some code... | FLUME::dike | | Wed Mar 22 1989 08:30 | 22 |
| This code fragment is based on the documentation. I haven't actually run it or
anything.
{
char *text;
DwtGetNextSegment(context, &text, ... rest of args...);
...
do something with text
...
XtFree(text);
}
text is declared as a character pointer, and occupies 4 bytes. Its address
gets passed in to DwtGetNextSegment, which allocates memory for the string
and puts the address of that memory in text. When you come back, text will
point at that memory, which contains the string that you asked for.
Hope this helps...
Jeff
|
443.8 | Thanks | HGOVC::KENBERKUN | Klaatu Barato Nikto | Thu Mar 23 1989 05:18 | 7 |
| Well, I'm slow but I get there.. Yup, I left off the darn &. Stuck
it in and it works fine now!
Thanks very much.
Ken B.
|