Thomas Davie wrote:
I'm not familiar with your C++ example (not being familiar with C++),
but I think that it's a bit of a stretch of the imagination to say
that C introduces a variable of type array of 50 ints, the fact
that this is now an array of 50 integers is never checked at any
At 9:24 AM -0400 2005/5/7, Daniel Carrera wrote:
Hello,
Right now I'm using type declarations like:
f :: Int - [Int]
So f returns a list of Ints.
Is there a way to tell Haskell that a list or array must have
exactly (say) 256 elements? I'd love to have Haskell make sure that
the array I build is
Hamilton Richards wrote:
Well, for starters, lists and arrays are two entirely different topics.
I've noticed that Haskell newbies sometimes confuse them --possibly the
use of [] in list types and enumerations triggers an unconscious
association with [] used in conventional languages for array
On 5/7/05, Daniel Carrera [EMAIL PROTECTED] wrote:
Hamilton Richards wrote:
Well, for starters, lists and arrays are two entirely different topics.
I've noticed that Haskell newbies sometimes confuse them --possibly the
use of [] in list types and enumerations triggers an unconscious
On 20050507T093613-0700, Fergus Henderson wrote:
On 07-May-2005, Hamilton Richards [EMAIL PROTECTED] wrote:
As far as I know, the last programming language that included
arrays' sizes in their types was Standard Pascal,
There have been many such languages since Standard Pascal. For
Antti-Juhani Kaijanaho [EMAIL PROTECTED] writes:
As far as I know, the last programming language that included
arrays' sizes in their types was Standard Pascal,
There have been many such languages since Standard Pascal. For
example C, C++, C#, Java, Ada, VHDL, and NU-Prolog.
C, C++ and
Sebastian Sylvan [EMAIL PROTECTED] writes:
A list is, for me, more of a logical entity (as opposed to
structural). It's a sequence of stuff not a particular way to
store it (singly-linked, doubly-linked, arraylists etc.).
I call it sequence.
A list is usually a concrete type in a given
No, it introduces a variable of type array of 50 ints, which can be
converted to pointer to int.
It matters when you make a pointer of such arrays, an array of such
arrays, or sizeof such array. In C++ the size can be matched by
template parameter, and you can have separate overloadings for
On 20050507T203246+0200, Marcin 'Qrczak' Kowalczyk wrote:
In C and C++, the declaration int n[50]; introduces an array variable
with size 50 having the type array of int. The size is *not* part of
the type.
No, it introduces a variable of type array of 50 ints, which can be
converted to
GCC knows how big an array is:
jake$ cat arrsizetest.c
#include stdio.h
int main()
{
int a[50];
printf(sizeof a == %d\n,sizeof(a));
return 0;
}
jake$ gcc arrsizetest.c
jake$ ./a.out
sizeof a == 200
jacob
On Sat, 7 May 2005, Thomas Davie wrote:
No, it introduces a variable
Thomas Davie [EMAIL PROTECTED] writes:
I'm not familiar with your C++ example (not being familiar with C++),
but I think that it's a bit of a stretch of the imagination to say
that C introduces a variable of type array of 50 ints, the fact
that this is now an array of 50 integers is never
On 20050507T120430-0400, Daniel Carrera wrote:
I think it's because there's no real reason for someone to think that
the words list and array might not be synonims. I certainly don't
seen a linguistic distinction. Either term refers to an ordered
collection of items.
I don't even know what
Antti-Juhani Kaijanaho wrote:
Your mistake is the start talking about groups as you do in every day
English part.
The point I'm trying to make is that you can't necessarily predict that
a programming language will abscribe special meaning to standard known
words like group or list. I can very
On 7 May, Daniel Carrera wrote:
Hello,
Right now I'm using type declarations like:
f :: Int - [Int]
So f returns a list of Ints.
Is there a way to tell Haskell that a list or array must have exactly
(say) 256 elements? I'd love to have Haskell make sure that the array I
build is
On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote:
Thomas Davie [EMAIL PROTECTED] writes:
I'm not familiar with your C++ example (not being familiar with C++),
but I think that it's a bit of a stretch of the imagination to say
that C introduces a variable of type array of 50 ints, the
On Sat, 7 May 2005, Abraham Egnor wrote:
So does ghc:
...
That doesn't mean the size is part of the *type*.
Sure. I'm just pointing out that
int a[50];
is not *quite* the same as
int *a = (int *)malloc(50 * sizeof(int));
jacob
___
Haskell-Cafe
On Sat, May 07, 2005 at 08:20:15PM +0100, Thomas Davie wrote:
On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote:
The size is taken into account when such array type is an element of
another array, and by sizeof.
int (*p)[50]; /* p may legally point only to arrays of 50 ints each */
David Roundy [EMAIL PROTECTED] writes:
No, int (*p)[50] is a multidimensional array, one of the most useless
concepts in C, and is equivalent to int p[50][] (or is it p[][50]...
I always get my matrix subscripts messed up).
No, it's not equivalent to either. Array type are not the same as
On 20050507T212832+0200, Marcin 'Qrczak' Kowalczyk wrote:
ISO 9899:1999 (C99) section 6.7.5.2:3 says that its type is array of
int, not array of 50 ints:
Ok, so in C terminology type is different from most statically typed
languages in this respect. The dimension is used together with the
At 9:36 AM -0700 2005/5/7, Fergus Henderson wrote:
On 07-May-2005, Hamilton Richards [EMAIL PROTECTED] wrote:
As far as I know,
the last programming language that included arrays' sizes in their
types was Standard Pascal,
There have been many such languages since Standard Pascal.
For example C,
Hamilton Richards [EMAIL PROTECTED] writes:
That's not the case in C, C++, Java, or Ada. In C and C++, for
example, given two arrays
int X[50];
int Y[100];
and a function declared as
void P( int a[] )
then these calls
P( X )
P( Y )
are both valid,
At 12:04 PM -0700 2005/5/7, Jacob Nelson wrote:
GCC knows how big an array is:
jake$ cat arrsizetest.c
#include stdio.h
int main()
{
int a[50];
printf(sizeof a == %d\n,sizeof(a));
return 0;
}
jake$ gcc arrsizetest.c
jake$ ./a.out
sizeof a == 200
jacob
gcc knows the size of
22 matches
Mail list logo