Thank for your answers, makes a lot of sense.

Em quarta-feira, 6 de março de 2024 às 02:24:50 UTC-3, Kurtis Rader 
escreveu:

> Anyone familiar with C/C++ will be familiar with the current convention of 
> using an asterisk to indicate a pointer to the value. Yes, there is a 
> reasonable argument for using an ampersand but either syntax is essentially 
> arbitrary; thus a coin flip as to which to use. So we might as well use the 
> C convention which a lot of programmers are familiar with rather than using 
> the alternative.
>
> On Tue, Mar 5, 2024 at 8:33 PM Matheus Fassis Corocher <
> matheus...@gmail.com> wrote:
>
>> I was studying about pointers and struct in Golang and one thing that I 
>> don't understand is why using * in return of signature of function instead 
>> of & if the return of function is an address of variable?
>>
>> The correct version that works:
>>
>> func NewVertex(X, Y int) **Vertex* {
>>   ...
>>   return &Vertex{X, Y}
>> }
>>
>> The version in my mind should be correct:
>>
>> func NewVertex(X, Y int) *&Vertex* {
>>   ...
>>   return &Vertex{X, Y}
>> }
>>
>> -- 
>> 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/9c60ff1f-6ddb-4136-bfab-642c102a47c7n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/9c60ff1f-6ddb-4136-bfab-642c102a47c7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> 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/ddc04b68-61a6-496d-a451-10498541c3dbn%40googlegroups.com.

Reply via email to