I’ve write ‘Hello world’ program but when I ran is always error ? Why ?
Does anyone know ?
Thank’s
I’ve write ‘Hello world’ program but when I ran is always error ? Why ?
Does anyone know ?
Thank’s
In article <b2s0f6$gj5$1@inn.qnx.com>, yoesak@yahoo.com says…
I’ve write ‘Hello world’ program but when I ran is always error ? Why ?
Does anyone know ?
I bet you missed dot…
Try:
…/hello
Also 10 bucks on red… that’s
Did you name your executable ‘test’?
Cheers,
Eduard.
Thank’s
QNX Momentics <yoesak@yahoo.com> wrote:
I’ve write ‘Hello world’ program but when I ran is always error ? Why ?
Does anyone know ?
You are missing the comma after “Hello”. The program should print “Hello, world”.
This is “cafe” after all
Cheers,
-RK
–
Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.
Robert Krten <nospam84@parse.com> wrote:
: QNX Momentics <yoesak@yahoo.com> wrote:
:> I’ve write ‘Hello world’ program but when I ran is always error ? Why ?
:> Does anyone know ?
: You are missing the comma after “Hello”. The program should print “Hello, world”.
Thanks, Rob. The editors of the world salute you!
Steve Reid <stever@qnx.com> wrote:
Robert Krten <> nospam84@parse.com> > wrote:
: QNX Momentics <> yoesak@yahoo.com> > wrote:
:> I’ve write ‘Hello world’ program but when I ran is always error ? Why ?
:> Does anyone know ?: You are missing the comma after “Hello”. The program should print “Hello, world”.
Thanks, Rob. The editors of the world salute you!
OK. This BS has gone on long enough!
Think about it. For 30 years now people have been writing
“Hello, world”. “Hello world” is an expression, something you say.
No one says “Hello” and then thinks about it a little and then adds
“, world” in the spoken voice.
So in reality the poor guy fixed a vary long standing bug!
It’s funny. When certain bugs are around for so long, you just kind
of get used to them and accept them as the norm and no one even
questions them any more.
G E N E R A L A P P L I C A T I O N F A I L U R E
(strike any key to continue)
Bill Caroselli <qtps@earthlink.net> wrote:
: OK. This BS has gone on long enough!
: Think about it. For 30 years now people have been writing
: “Hello, world”. “Hello world” is an expression, something you say.
: No one says “Hello” and then thinks about it a little and then adds
: “, world” in the spoken voice.
Actually, there is a tiny pause in there. Let’s look at another example:
“Hail, Mary” (Salutation to you, Mary)
“Hail Mary” (Cousin to Calamity Jane, Typhoid Mary, and Hurricane Gilbert)
qtps@earthlink.net sed in <b2triu$knm$1@inn.qnx.com>:
“Hello world” is an expression, something you say.
It IS an expression of a const char *.
–
kabe
Wait, did I miss the trailing `;’?
kabe@sra-tohoku.co.jp wrote:
qtps@earthlink.net > sed in <b2triu$knm$> 1@inn.qnx.com> >:
“Hello world” is an expression, something you say.
It IS an expression of a const char *.
Actually, it’s an array of char. It may or may not get converted to a
char * depending on the context.
Wojtek Lerch <wojtek_l@yahoo.ca> wrote in message
news:b32v65$i48$2@inn.qnx.com…
kabe@sra-tohoku.co.jp > wrote:
qtps@earthlink.net > sed in <b2triu$knm$> 1@inn.qnx.com> >:“Hello world” is an expression, something you say.
It IS an expression of a const char *.
Actually, it’s an array of char. It may or may not get converted to a
char * depending on the context.
A const array of char.
-Adam
Steve Reid <stever@qnx.com> wrote:
Bill Caroselli <> qtps@earthlink.net> > wrote:
: OK. This BS has gone on long enough!: Think about it. For 30 years now people have been writing
: “Hello, world”. “Hello world” is an expression, something you say.
: No one says “Hello” and then thinks about it a little and then adds
: “, world” in the spoken voice.Actually, there is a tiny pause in there. Let’s look at another example:
“Hail, Mary” (Salutation to you, Mary)
“Hail Mary” (Cousin to Calamity Jane, Typhoid Mary, and Hurricane Gilbert)
Of course, if English had a vocative case (as in Latin or
Sanskrit), you’d be able to get the meaning from inflection
alone – the comma wouldn’t be necessary. For example:
Et tu Brute? (You too, Brutus?)
johno
Adam Mallory <amallory@qnx.com> wrote:
Wojtek Lerch <> wojtek_l@yahoo.ca> > wrote in message
news:b32v65$i48$> 2@inn.qnx.com> …
kabe@sra-tohoku.co.jp > wrote:
qtps@earthlink.net > sed in <b2triu$knm$> 1@inn.qnx.com> >:“Hello world” is an expression, something you say.
It IS an expression of a const char *.
Actually, it’s an array of char. It may or may not get converted to a
char * depending on the context.A const array of char.
Not according to the C Standard:
6.4.5 String literals
…
5 In translation phase 7, a byte or code of value zero is appended to
each multibyte character sequence that results from a string literal
or literals. The multibyte character sequence is then used to
initialize an array of static storage duration and length just
sufficient to contain the sequence. For character string literals,
the array elements have type char, and are initialized with the
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
individual bytes of the multibyte character sequence; for wide
string literals, the array elements have type wchar_t, and are
initialized with the sequence of wide characters corresponding to
the multibyte character sequence, as defined by the mbstowcs
function with an implementation-defined current locale. The value
of a string literal containing a multibyte character or escape
sequence not represented in the execution character set is
implementation-defined.
6 It is unspecified whether these arrays are distinct provided their
elements have the appropriate values. If the program attempts to
modify such an array, the behavior is undefined.
Wojtek, your quotation only speaks to the type of the array elements, not to
the type of the array itself.
dB
“Wojtek Lerch” <wojtek_l@yahoo.ca> wrote in message
news:b35rv0$r2h$2@inn.qnx.com…
Adam Mallory <> amallory@qnx.com> > wrote:
Wojtek Lerch <> wojtek_l@yahoo.ca> > wrote in message
news:b32v65$i48$> 2@inn.qnx.com> …
kabe@sra-tohoku.co.jp > wrote:
qtps@earthlink.net > sed in <b2triu$knm$> 1@inn.qnx.com> >:“Hello world” is an expression, something you say.
It IS an expression of a const char *.
Actually, it’s an array of char. It may or may not get converted to a
char * depending on the context.A const array of char.
Not according to the C Standard:
6.4.5 String literals
…
5 In translation phase 7, a byte or code of value zero is appended to
each multibyte character sequence that results from a string literal
or literals. The multibyte character sequence is then used to
initialize an array of static storage duration and length just
sufficient to contain the sequence. For character string literals,
the array elements have type char, and are initialized with the
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
individual bytes of the multibyte character sequence; for wide
string literals, the array elements have type wchar_t, and are
initialized with the sequence of wide characters corresponding to
the multibyte character sequence, as defined by the mbstowcs
function with an implementation-defined current locale. The value
of a string literal containing a multibyte character or escape
sequence not represented in the execution character set is
implementation-defined.6 It is unspecified whether these arrays are distinct provided their
elements have the appropriate values. If the program attempts to
modify such an array, the behavior is undefined.
“Wojtek Lerch” <> wojtek_l@yahoo.ca> > wrote in message
news:b35rv0$r2h$> 2@inn.qnx.com> …
6.4.5 String literals5 In translation phase 7, a byte or code of value zero is appended to
each multibyte character sequence that results from a string literal
or literals. The multibyte character sequence is then used to
initialize an array of static storage duration and length just
sufficient to contain the sequence. For character string literals,
the array elements have type char, and are initialized with the
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
individual bytes of the multibyte character sequence; for wide
6 It is unspecified whether these arrays are distinct provided their
elements have the appropriate values. If the program attempts to
modify such an array, the behavior is undefined.
dbacon@qnx.com sed in <b366fe$4fd$1@nntp.qnx.com>:
Wojtek, your quotation only speaks to the type of the array elements, not to
the type of the array itself.
Does that matter?
Array is inherently const, so only the element constness matters.
i.e you can’t `buf = ;’ when declared char buf[1024].
For pointers, the pointer itself and the dereferenced element both matters
i.e const char * const p;
*p is const ^^^^^ ^^^^^ p is const
–
kabe
I think Wojtek is correct in terms of the standard. But the modification
of said array is also undefined, which IMHO would make the datum contained
in the array non-mutable (to achieve defined behaviour), and thus, in
effect, constant (just not const as I had originally stated).
-Adam
<kabe@sra-tohoku.co.jp> wrote in message news:b3ate4$ho5$1@inn.qnx.com…
“Wojtek Lerch” <> wojtek_l@yahoo.ca> > wrote in message
news:b35rv0$r2h$> 2@inn.qnx.com> …
6.4.5 String literals5 In translation phase 7, a byte or code of value zero is appended
to
each multibyte character sequence that results from a string
literal
or literals. The multibyte character sequence is then used to
initialize an array of static storage duration and length just
sufficient to contain the sequence. For character string
literals,
the array elements have type char, and are initialized with the
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
individual bytes of the multibyte character sequence; for wide
6 It is unspecified whether these arrays are distinct provided
their
elements have the appropriate values. If the program attempts to
modify such an array, the behavior is undefined.dbacon@qnx.com > sed in <b366fe$4fd$> 1@nntp.qnx.com> >:
Wojtek, your quotation only speaks to the type of the array elements,
not to
the type of the array itself.Does that matter?
Array is inherently const, so only the element constness matters.
i.e you can’t `buf = ;’ when declared char buf[1024].For pointers, the pointer itself and the dereferenced element both matters
i.e const char * const p;
*p is const ^^^^^ ^^^^^ p is const–
kabe
David Bacon <dbacon@qnx.com> wrote:
Wojtek, your quotation only speaks to the type of the array elements, not to
the type of the array itself.
If the type of an array is “const T[]”, then the type of its elements is
“const T”. In other words, there’s no such thing as a “const array of
char” in C – it’s always an “array of const char”:
6.2.5p20
Adam Mallory <amallory@qnx.com> wrote:
I think Wojtek is correct in terms of the standard. But the modification
of said array is also undefined, which IMHO would make the datum contained
in the array non-mutable (to achieve defined behaviour), and thus, in
effect, constant (just not const as I had originally stated).
Right; the reason the type is not const is because there’s too much
existing code that does this:
char *string = “Hello”;
and it would require a diagnostic if the array was const.
The undefined behaviour when you try to modify it is there to allow (but
not require) the compiler to put the array in write-protected memory.
Wojtek Lerch <wojtek_l@yahoo.ca> wrote in message
news:b3e3vb$6sk$1@inn.qnx.com…
Right; the reason the type is not const is because there’s too much
existing code that does this:char *string = “Hello”;
and it would require a diagnostic if the array was const.
Very true.
The undefined behaviour when you try to modify it is there to allow (but
not require) the compiler to put the array in write-protected memory.
Yes, this part was what I was rather inarticulately refering to.
-Adam