Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!uniwa!vax7!tnorthtj From: North_TJ@cc.curtin.edu.au (Tim North) Newsgroups: comp.lang.pascal Subject: Re: 10 Reasons (semantic error?) Message-ID: <4845.2753aa2e@cc.curtin.edu.au> Date: 28 Nov 90 04:14:37 GMT References: <40098@ut-emx.uucp> <40100@ut-emx.uucp> Organization: Curtin University of Technology, Perth, W.Australia. Lines: 39 In article <40100@ut-emx.uucp>, mjensen@ccwf.cc.utexas.edu (Marc S. Jensen) writes: > I saw this in a magazine recently, and just thought you all might find > it amusing: > > > 10 Reasons Why Pascal is Better than C, by Owen Hartnett > ======================================================== > > 10. In C, you can do this: > > for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2); > > In Pascal, you can't do this: > > for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2); > I'm a little confused about the type of th argument to the function P. In the first two calls to P we're passing in a string literal, but in subsequent calls we've got a mixed type expression; e.g. P("| " + (*u/4)%2) Here the argument seems to be the sum of a string literal and an integer. What's happening here? Is th first character of the string literal being cast to an integer before the addition occurs? Cheers, ------------------------------------------------------------------------------- --------- | Dept. Computer Engineering, Curtin University of Technology / o ---- | Perth. Western Australia. / / / / / | Internet: North_TJ@cc.curtin.edu.au / / / / / | Bitnet: North_TJ%cc.curtin.edu.au@cunyvm.bitnet | UUCP: uunet!munnari.oz!cc.curtin.edu.au!North_TJ _--_|\ |------------------------------------------------------------ / \ |I don't want to achieve immortality through my work... -->\_.--._/ |I want to achieve it through not dying! v | -- Woody Allen. ------------------------------------------------------------------------------