Re: meaning of a dialet or implementation of a programming language

From: John Thingstad (john.thingstad_at_chello.no)
Date: 09/24/04


Date: Fri, 24 Sep 2004 21:46:04 +0200

On Fri, 24 Sep 2004 21:10:51 +0200, John Thingstad
<john.thingstad@chello.no> wrote:

> On 24 Sep 2004 13:16:31 -0400, Matthew Danish <mrd+nospam@cmu.edu> wrote:
>
>> "John Thingstad" <john.thingstad@chello.no> writes:
>>> On 24 Sep 2004 09:16:46 -0700, Jaap Weel <mylastname@caltech.edu>
>>> wrote:
>>> > Type-safe: in Lisp (+ 3 "a") just barfs, because it does not make
>>> > sense within the type system. Type safety can also be implemented in
>>> a
>>> > static type system (e.g. ML). In C, a type-unsafe language, 3 + "a"
>>> > returns a value of which the representation in hardware is obtained
>>> by
>>> > pretending the representation of the memory location of the string
>>> "3"
>>> > were the representation of an integer and adding it to 3.
>>> NO! That would be PERL. C does not do automatic type conversion.
>>
>> It's not about automatic type conversion. It has to do with strings
>> being pointers.
>>
>> $ cat test.c
>> #include<stdio.h>
>> int main(void) {
>> char *str = "foobar";
>> printf("%s\n", str + 3);
>> return 0;
>> }
>> $ gcc -Wall test.c
>> $ ./a.out
>> bar
>> $
>>
>
> Yes, but most peaple today use ANSI C or C++.
> You wouldn't talk about Lisp as of 1980 would you.
>

try gcc -ANSI -Pedantic -Wall test.c

-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


Relevant Pages

  • Re: A taxonomy of types
    ... however, elsewhere in my project (off in the dynamic typesystem, ...), I ... (since I am using NULL-terminated strings), and so I have used U+10FFFF ... remember, C also has things like arrays, funtion pointers, nestable ... int RIL_TypeSmallIntP; ...
    (comp.lang.misc)
  • RE: passing string array to C++
    ... Does this apply to all marshalling of passing arrays of pointers? ... other challenges in this area such as passing an array of pointers to class ... > private static extern int MyAdapt(int gbl, stringstrings, int count ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Problems with a program
    ... pointers and strings very well. ... The following is working source code: ... int main ...
    (microsoft.public.dotnet.academic)
  • Re: String Comparision
    ... code which would compare two strings using pointers. ... int comp ...
    (comp.lang.c)
  • Re: array of pointers
    ... All the three pointers point to literal strings, ... in memory that doesn't belong to you and that could be in read- ... If you want to change the memory the pointers are pointing ... > int size = strlen; ...
    (comp.lang.c)