Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Is this a Standard Portable C Program?

Reply
Thread Tools

Is this a Standard Portable C Program?

 
 
CBFalconer
Guest
Posts: n/a
 
      01-06-2009
Citizen C wrote:
>
> #include <stdio.h>
> #define p printf
> #define r0 return 0;
> #define P int main(void)\
> {\
> p("Hello world! NULL is %p\n", (void*)NULL);\
> r0\
> }
> P


PLONK.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      01-06-2009
wrote:
>
> On Jan 6, 12:33 am, Martin Ambuhl <mamb...@earthlink.net> wrote:
> > Stupid preprocessor tricks are for infants.

>
> do you know what else is for infants? MY ENORMOUS THROBBING COCK!


PLONK.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
 
Reply With Quote
 
 
 
 
jameskuyper
Guest
Posts: n/a
 
      01-06-2009
s0s...@gmail.com wrote:
> On Jan 6, 9:09�am, JC <jason.cipri...@gmail.com> wrote:
> > On Jan 6, 8:57�am, Richard <rgrd...@gmail.com> wrote:
> >
> > > vipps...@gmail.com writes:
> > > > On Jan 6, 12:58�pm, Richard <rgrd...@gmail.com> wrote:
> > > >> nick_keighley_nos...@hotmail.com writes:
> > > >> > Note 1: using a couple of compilers does *not* prove a program
> > > >> > standard and portable.

> >
> > > >> Actually it does prove its portable - between the machines of interest
> > > >> for those compiler versions he mentions.

> >
> > > > You're wrong. UB is UB. It may compile once without any errors and
> > > > never compile again with a lot of errors. Compiling proves nothing.

> >
> > > What UB?

> >
> > Any UB in general. Your assertion was that if two compilers accepted a
> > program, therefore the program was portable between those machines:
> >
> > > > Note 1: using a couple of compilers does *not* prove a program
> > > > standard and portable.

> >
> > > Actually it does prove its portable - between the machines of interest
> > > for those compiler versions he mentions.

> >
> > The assertion is false. To prove portability between two machines,
> > there must be no UB (when the implementation documentation is
> > considered along with the standard) in the programs. It is not enough
> > that two compilers accept it.

>
> Assuming that those two compilers will compile code for the two
> machines in question, you're contradicting yourself. If it is accepted
> by the two compilers, how is not portable to the two machines?


Presumably the code is supposed to perform some task; it is portable
if it performs essentially the same task on both machines (in some
cases, the task that should be performed is different on different
machines, which complicates the issue - that's the reason I use the
word "essentially"). If that's not what "portable" means to you, then
there's no problem.

The code could be correctly written to perform that task by relying
upon guarantees provided by the C standard. it could also be written
to have behavior that is undefined by the C standard, so long as it is
correctly written to perform that task by relying upon guarantees
provided by the documentation of both compilers.

However, you're in trouble if your code relies upon a guarantee that
is provided neither by the standard nor by the documentation for a
given compiler. When compiled by that compiler, the fact that the code
has been accepted gives you no indication, one way or another, about
whether or not it will perform the task it was intended to perform.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      01-06-2009
Keith Thompson wrote:
> writes:
>> JC <jason.cipri...@gmail.com> wrote:
>>

.... snip ...
>>
>>> The assertion is false. To prove portability between two machines,
>>> there must be no UB (when the implementation documentation is
>>> considered along with the standard) in the programs. It is not
>>> enough that two compilers accept it.

>>
>> Assuming that those two compilers will compile code for the two
>> machines in question, you're contradicting yourself. If it is
>> accepted by the two compilers, how is not portable to the two
>> machines?

>
> If the program invokes undefined behavior, it might be accepted by
> the two compilers, and then appear to work properly until it fails
> catastrophically at, for example, the next leap second.


And the manner of failing can be violently different on the two
machines.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
 
Reply With Quote
 
saul.plonkerton@gmail.com
Guest
Posts: n/a
 
      01-07-2009
On Jan 6, 3:40*pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> <saul.plonker...@gmail.com> wrote in message
>
> news:ceecede1-474e-4bc6-96c0-...
> On Jan 6, 12:33 am, Martin Ambuhl <mamb...@earthlink.net> wrote:
>
> > > Stupid preprocessor tricks are for infants.

> > do you know what else is for infants? MY ENORMOUS THROBBING COCK!

>
> You sick bastard; please, keep your private parts far away from the kids
> man! Wow.


On Jan 6, 3:40 pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> <saul.plonker...@gmail.com> wrote in message
>
> news:ceecede1-474e-4bc6-96c0-...
> On Jan 6, 12:33 am, Martin Ambuhl <mamb...@earthlink.net> wrote:
>
> > > Stupid preprocessor tricks are for infants.

> > do you know what else is for infants? MY ENORMOUS THROBBING COCK!

>
> You sick bastard; please, keep your private parts far away from the kids
> man! Wow.


han! check it out, i trolled Chris Thomasson!

beat that, mutha fugga!

who's the master troll now? hm?
 
Reply With Quote
 
saul.plonkerton@gmail.com
Guest
Posts: n/a
 
      01-07-2009
On Jan 6, 4:39*pm, CBFalconer <cbfalco...@yahoo.com> wrote:
> saul.plonker...@gmail.com wrote:
>
> > On Jan 6, 12:33 am, Martin Ambuhl <mamb...@earthlink.net> wrote:
> > > Stupid preprocessor tricks are for infants.

>
> > do you know what else is for infants? MY ENORMOUS THROBBING COCK!

>
> PLONK.


that's my name, don't wear it out!
 
Reply With Quote
 
Chris M. Thomasson
Guest
Posts: n/a
 
      01-07-2009
<> wrote in message
news:8f4d8ff5-4d4f-4c9a-b6a7-...
On Jan 6, 3:40 pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> > <saul.plonker...@gmail.com> wrote in message
> >
> > news:ceecede1-474e-4bc6-96c0-...
> > On Jan 6, 12:33 am, Martin Ambuhl <mamb...@earthlink.net> wrote:
> >
> > > > Stupid preprocessor tricks are for infants.
> > > do you know what else is for infants? MY ENORMOUS THROBBING COCK!

> >
> > You sick bastard; please, keep your private parts far away from the kids
> > man! Wow.

>
> On Jan 6, 3:40 pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> > <saul.plonker...@gmail.com> wrote in message
> >
> > news:ceecede1-474e-4bc6-96c0-...
> > On Jan 6, 12:33 am, Martin Ambuhl <mamb...@earthlink.net> wrote:
> >
> > > > Stupid preprocessor tricks are for infants.
> > > do you know what else is for infants? MY ENORMOUS THROBBING COCK!

> >
> > You sick bastard; please, keep your private parts far away from the kids
> > man! Wow.


> han! check it out, i trolled Chris Thomasson!


> beat that, mutha fugga!


> who's the master troll now? hm?


:^/

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-07-2009
"Chris M. Thomasson" <> writes:
[31 lines deleted]
>
> :^/


Chris, what is the purpose of quoting and re-quoting an offensive
article?

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Chris M. Thomasson
Guest
Posts: n/a
 
      01-08-2009
"Keith Thompson" <kst-> wrote in message
news:...
> "Chris M. Thomasson" <> writes:
> [31 lines deleted]
>>
>> :^/

>
> Chris, what is the purpose of quoting and re-quoting an offensive
> article?


I forgot to snip the text; sorry about that.

 
Reply With Quote
 
vippstar@gmail.com
Guest
Posts: n/a
 
      01-14-2009
On Jan 7, 8:00*pm, Keith Thompson <ks...@mib.org> wrote:
> "Chris M. Thomasson" <n...@spam.invalid> writes:
> [31 lines deleted]
>
>
>
> > :^/

>
> Chris, what is the purpose of quoting and re-quoting an offensive
> article?


Chris M. Thomasson is a troll, or at least I suspect so for some time
now. See, for example, my message here:
Message-ID:
<99c5114a-4005-4bfc-8a7f->

When I read that message again I realize I had used the snip feature
wrongly.
I think it implies that Chris said things that I considered as 'troll'
and snipped, when what I had done is snip the whole post of another
troll which Chris M. Thomasson replied to.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Portable/standard way of counting number of bits in variable? Dale Dellutri C Programming 9 04-04-2009 03:40 PM
is this portable, conforming to standard, elegant? r.z. C++ 32 02-17-2007 08:57 AM
Portable Python - free portable development environment ! perica.zivkovic@gmail.com Python 7 01-13-2007 11:19 AM
portable (VHDL) vs. non-portable (altera LPM) approaches to signed computations Eli Bendersky VHDL 1 03-01-2006 02:43 PM
Directory/File recursive listing using standard/portable C? ibic C Programming 10 11-22-2004 06:15 AM



Advertisments