Re: [go-nuts] Re: What's the maximum array length?

2022-10-30 Thread Ian Lance Taylor
On Sun, Oct 30, 2022, 6:38 PM eric...@arm.com  wrote:

> > That appears to be the primary limit. That including a composite literal
> initializer that exceeds that limit, causing a more ambiguous error, >
> seems like a related, but secondary, issue.
>
> Yes, this seems to be a related question, see
> https://github.com/golang/go/issues/9862. If we do not allow static data
> larger than 2G, then the description of the array in the spec may need to
> be slightly modified?
>

That would be an implementation restriction for a particular
implementation, not a language change.  We could add it to the spec.
Though I think it's reasonably clear that no implementation will be able to
support a very large array even if the language permits it, and that the
precise definition of "very large" is implementation dependent.

Ian




在2022年10月29日星期六 UTC+8 17:37:32 写道:
>
>> On Saturday, October 29, 2022 at 3:52:16 PM UTC+8
>> axel.wa...@googlemail.com wrote:
>>
>>> You might want to check out the order of messages as seen by google
>>> groups: https://groups.google.com/g/golang-nuts/c/mw5f2kyEjpA
>>> Either your Message was delivered to groups delayed, or Kurtis message
>>> was delivered delayed to you.
>>>
>>
>> I don't think the order matters at all here. ;)
>>
>>
>>>
>>> On Sat, Oct 29, 2022 at 9:44 AM T L  wrote:
>>>


 On Sat, Oct 29, 2022 at 12:11 PM Kurtis Rader 
 wrote:

 Did you not see my reply pointing out the same thing? That is, given a
 particular platform and executable format the limit is likely to be much
 less than math.MaxInt. Alternatively, was my reply not clear about the
 practical versus theoretical limit of the size of an array? Which is not to
 say that your reply is invalid. I'm just curious how you view your reply as
 being more clear than mine. :-)


> On Fri, Oct 28, 2022 at 8:57 PM tapi...@gmail.com 
> wrote:
>
>> The max array length is math.MaxInt. "[math.MaxInt]struct{}" is valid,
>> though the practical size of non-zero-size array is hard limited in
>> some way.
>>
>> On Friday, October 28, 2022 at 9:43:16 AM UTC+8 eric...@arm.com
>> wrote:
>>
>>> The spec says that " The length is part of the array's type; it must
>>> evaluate to a non-negative constant
>>>  representable
>>>  by a value of
>>> type int. ", so on a 64-bit environment, I assume that the maximum array
>>> length should be math.MaxInt64, am I right ? But the following code 
>>> doesn't
>>> compile:
>>>
>>> package main
>>> var x = [1<<34]byte{1<<23: 23, 1<<24: 24, 1<<33:33}
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/df18462d-4ec1-4287-ad71-ef4aa0d85a5dn%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>
 --
 You received this message because you are subscribed to the Google
 Groups "golang-nuts" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to golang-nuts...@googlegroups.com.

>>> To view this discussion on the web visit
 https://groups.google.com/d/msgid/golang-nuts/CAHbs%3DNbmgsUet1GW4AbbBeOQ9xeUZd92ybb28L-m1O8-Ze3CtQ%40mail.gmail.com
 
 .

>>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/624b7b28-b750-40a0-9407-d3fe16d1f956n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWjD-8FEK3bKHgaAPtzkujwpEQWSxeXvz_0X-rFmfSd4Q%40mail.gmail.com.


Re: [go-nuts] Re: What's the maximum array length?

2022-10-30 Thread eric...@arm.com
> That appears to be the primary limit. That including a composite literal 
initializer that exceeds that limit, causing a more ambiguous error, > 
seems like a related, but secondary, issue.

Yes, this seems to be a related question, see 
https://github.com/golang/go/issues/9862. If we do not allow static data 
larger than 2G, then the description of the array in the spec may need to 
be slightly modified?

在2022年10月29日星期六 UTC+8 17:37:32 写道:

> On Saturday, October 29, 2022 at 3:52:16 PM UTC+8 
> axel.wa...@googlemail.com wrote:
>
>> You might want to check out the order of messages as seen by google 
>> groups: https://groups.google.com/g/golang-nuts/c/mw5f2kyEjpA
>> Either your Message was delivered to groups delayed, or Kurtis message 
>> was delivered delayed to you.
>>
>
> I don't think the order matters at all here. ;)
>  
>
>>
>> On Sat, Oct 29, 2022 at 9:44 AM T L  wrote:
>>
>>>
>>>
>>> On Sat, Oct 29, 2022 at 12:11 PM Kurtis Rader  
>>> wrote:
>>>
>>> Did you not see my reply pointing out the same thing? That is, given a 
>>> particular platform and executable format the limit is likely to be much 
>>> less than math.MaxInt. Alternatively, was my reply not clear about the 
>>> practical versus theoretical limit of the size of an array? Which is not to 
>>> say that your reply is invalid. I'm just curious how you view your reply as 
>>> being more clear than mine. :-)
>>>
>>>
 On Fri, Oct 28, 2022 at 8:57 PM tapi...@gmail.com  
 wrote:

> The max array length is math.MaxInt. "[math.MaxInt]struct{}" is valid,
> though the practical size of non-zero-size array is hard limited in 
> some way.
>
> On Friday, October 28, 2022 at 9:43:16 AM UTC+8 eric...@arm.com wrote:
>
>> The spec says that " The length is part of the array's type; it must 
>> evaluate to a non-negative constant 
>>  representable 
>>  by a value of 
>> type int. ", so on a 64-bit environment, I assume that the maximum array 
>> length should be math.MaxInt64, am I right ? But the following code 
>> doesn't 
>> compile:
>>
>> package main
>> var x = [1<<34]byte{1<<23: 23, 1<<24: 24, 1<<33:33}
>>
> -- 
> You received this message because you are subscribed to the Google 
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/df18462d-4ec1-4287-ad71-ef4aa0d85a5dn%40googlegroups.com
>  
> 
> .
>


 -- 
 Kurtis Rader
 Caretaker of the exceptional canines Junior and Hank

>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to golang-nuts...@googlegroups.com.
>>>
>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/golang-nuts/CAHbs%3DNbmgsUet1GW4AbbBeOQ9xeUZd92ybb28L-m1O8-Ze3CtQ%40mail.gmail.com
>>>  
>>> 
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/624b7b28-b750-40a0-9407-d3fe16d1f956n%40googlegroups.com.


Re: [go-nuts] Re: What's the maximum array length?

2022-10-29 Thread tapi...@gmail.com


On Saturday, October 29, 2022 at 3:52:16 PM UTC+8 axel.wa...@googlemail.com 
wrote:

> You might want to check out the order of messages as seen by google 
> groups: https://groups.google.com/g/golang-nuts/c/mw5f2kyEjpA
> Either your Message was delivered to groups delayed, or Kurtis message was 
> delivered delayed to you.
>

I don't think the order matters at all here. ;)
 

>
> On Sat, Oct 29, 2022 at 9:44 AM T L  wrote:
>
>>
>>
>> On Sat, Oct 29, 2022 at 12:11 PM Kurtis Rader  
>> wrote:
>>
>> Did you not see my reply pointing out the same thing? That is, given a 
>> particular platform and executable format the limit is likely to be much 
>> less than math.MaxInt. Alternatively, was my reply not clear about the 
>> practical versus theoretical limit of the size of an array? Which is not to 
>> say that your reply is invalid. I'm just curious how you view your reply as 
>> being more clear than mine. :-)
>>
>>
>>> On Fri, Oct 28, 2022 at 8:57 PM tapi...@gmail.com  
>>> wrote:
>>>
 The max array length is math.MaxInt. "[math.MaxInt]struct{}" is valid,
 though the practical size of non-zero-size array is hard limited in 
 some way.

 On Friday, October 28, 2022 at 9:43:16 AM UTC+8 eric...@arm.com wrote:

> The spec says that " The length is part of the array's type; it must 
> evaluate to a non-negative constant 
>  representable 
>  by a value of type int. ", 
> so on a 64-bit environment, I assume that the maximum array length should 
> be math.MaxInt64, am I right ? But the following code doesn't compile:
>
> package main
> var x = [1<<34]byte{1<<23: 23, 1<<24: 24, 1<<33:33}
>
 -- 
 You received this message because you are subscribed to the Google 
 Groups "golang-nuts" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to golang-nuts...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/golang-nuts/df18462d-4ec1-4287-ad71-ef4aa0d85a5dn%40googlegroups.com
  
 
 .

>>>
>>>
>>> -- 
>>> Kurtis Rader
>>> Caretaker of the exceptional canines Junior and Hank
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/CAHbs%3DNbmgsUet1GW4AbbBeOQ9xeUZd92ybb28L-m1O8-Ze3CtQ%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e6d14277-deea-4918-b0f2-6b3ef5280aeen%40googlegroups.com.


Re: [go-nuts] Re: What's the maximum array length?

2022-10-29 Thread 'Axel Wagner' via golang-nuts
You might want to check out the order of messages as seen by google groups:
https://groups.google.com/g/golang-nuts/c/mw5f2kyEjpA
Either your Message was delivered to groups delayed, or Kurtis message was
delivered delayed to you.

On Sat, Oct 29, 2022 at 9:44 AM T L  wrote:

>
>
> On Sat, Oct 29, 2022 at 12:11 PM Kurtis Rader 
> wrote:
>
> Did you not see my reply pointing out the same thing? That is, given a
> particular platform and executable format the limit is likely to be much
> less than math.MaxInt. Alternatively, was my reply not clear about the
> practical versus theoretical limit of the size of an array? Which is not to
> say that your reply is invalid. I'm just curious how you view your reply as
> being more clear than mine. :-)
>
>
>> On Fri, Oct 28, 2022 at 8:57 PM tapi...@gmail.com 
>> wrote:
>>
>>> The max array length is math.MaxInt. "[math.MaxInt]struct{}" is valid,
>>> though the practical size of non-zero-size array is hard limited in some
>>> way.
>>>
>>> On Friday, October 28, 2022 at 9:43:16 AM UTC+8 eric...@arm.com wrote:
>>>
 The spec says that " The length is part of the array's type; it must
 evaluate to a non-negative constant 
  representable  by a value
 of type int. ", so on a 64-bit environment, I assume that the maximum array
 length should be math.MaxInt64, am I right ? But the following code doesn't
 compile:

 package main
 var x = [1<<34]byte{1<<23: 23, 1<<24: 24, 1<<33:33}

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/golang-nuts/df18462d-4ec1-4287-ad71-ef4aa0d85a5dn%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Kurtis Rader
>> Caretaker of the exceptional canines Junior and Hank
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAHbs%3DNbmgsUet1GW4AbbBeOQ9xeUZd92ybb28L-m1O8-Ze3CtQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfHbXNQ6S2OFHwmbWm-pCM96Ui7KduLHg-kHGfS%2Bt5CEog%40mail.gmail.com.


Re: [go-nuts] Re: What's the maximum array length?

2022-10-29 Thread T L
On Sat, Oct 29, 2022 at 12:11 PM Kurtis Rader  wrote:

Did you not see my reply pointing out the same thing? That is, given a
particular platform and executable format the limit is likely to be much
less than math.MaxInt. Alternatively, was my reply not clear about the
practical versus theoretical limit of the size of an array? Which is not to
say that your reply is invalid. I'm just curious how you view your reply as
being more clear than mine. :-)


> On Fri, Oct 28, 2022 at 8:57 PM tapi...@gmail.com 
> wrote:
>
>> The max array length is math.MaxInt. "[math.MaxInt]struct{}" is valid,
>> though the practical size of non-zero-size array is hard limited in some
>> way.
>>
>> On Friday, October 28, 2022 at 9:43:16 AM UTC+8 eric...@arm.com wrote:
>>
>>> The spec says that " The length is part of the array's type; it must
>>> evaluate to a non-negative constant 
>>> representable  by a value of
>>> type int. ", so on a 64-bit environment, I assume that the maximum array
>>> length should be math.MaxInt64, am I right ? But the following code doesn't
>>> compile:
>>>
>>> package main
>>> var x = [1<<34]byte{1<<23: 23, 1<<24: 24, 1<<33:33}
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/golang-nuts/df18462d-4ec1-4287-ad71-ef4aa0d85a5dn%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAHbs%3DNbmgsUet1GW4AbbBeOQ9xeUZd92ybb28L-m1O8-Ze3CtQ%40mail.gmail.com.


[go-nuts] Re: What's the maximum array length?

2022-10-28 Thread tapi...@gmail.com
The max array length is math.MaxInt. "[math.MaxInt]struct{}" is valid,
though the practical size of non-zero-size array is hard limited in some 
way.

On Friday, October 28, 2022 at 9:43:16 AM UTC+8 eric...@arm.com wrote:

> The spec says that " The length is part of the array's type; it must 
> evaluate to a non-negative constant  
> representable  by a value of 
> type int. ", so on a 64-bit environment, I assume that the maximum array 
> length should be math.MaxInt64, am I right ? But the following code doesn't 
> compile:
>
> package main
> var x = [1<<34]byte{1<<23: 23, 1<<24: 24, 1<<33:33}
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/df18462d-4ec1-4287-ad71-ef4aa0d85a5dn%40googlegroups.com.