<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[linlujun]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/MaxCoderLlj</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; MaxCoderLlj]]></copyright><item><title><![CDATA[golang 局部变量地址作为返回值]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/104216465</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/104216465</guid><author>MaxCoderLlj</author><pubDate>Fri, 07 Feb 2020 22:21:59 +0800</pubDate><description><![CDATA[golang 局部变量地址作为返回值的问题
func createNode(v int) *node{
	return &amp;node{value:v} 
}

func main(){
	var root *node
	root=createNode(10)
	...
}


在c/c++语言中，以上的代码逻辑显然有问题，createNode函数中创建了一个局部变量（空间分配在栈上），并将其...]]></description><category></category></item><item><title><![CDATA[golang Lazy Evaluation]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80561396</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80561396</guid><author>MaxCoderLlj</author><pubDate>Sun, 03 Jun 2018 22:59:21 +0800</pubDate><description><![CDATA[func Interge() &amp;amp;lt;-chan int {
    yield := make(chan int)
    count := 0
    go func() {
        for {
            yield &amp;amp;lt;- count
            count++
        }
    }()
    return yield
}

var resu...]]></description><category></category></item><item><title><![CDATA[golang 关于defer的一道题]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80502396</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80502396</guid><author>MaxCoderLlj</author><pubDate>Tue, 29 May 2018 21:24:43 +0800</pubDate><description><![CDATA[func calc(x, y int) int {
    fmt.Println(x, y, x+y)
    return x + y

}
func main() {
    a := 1
    b := 2
    defer calc(a, calc(a, b))
    a = 0
    defer calc(a, calc(a, b))
}




执行结果



1.defer...]]></description><category></category></item><item><title><![CDATA[golang 内置函数new()和make()的区别]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80218025</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80218025</guid><author>MaxCoderLlj</author><pubDate>Sat, 26 May 2018 14:59:10 +0800</pubDate><description><![CDATA[golang中的new和make

make用于内建类型（map、slice 和channel）的内存分配。new用于各种类型的内存分配。

内建函数new本质上说跟其它语言中的同名函数功能一样：new(T)分配了零值填充的T类型的内存空间，并且返回其地址，即一个*T类型的值。用Go的术语说，它返回了一个指针，指向新分配的类型T的零值。有一点非常重要：new返回指针。

内建函数make(T, a...]]></description><category></category></item><item><title><![CDATA[golang 切片合并（1）]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80380540</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80380540</guid><author>MaxCoderLlj</author><pubDate>Sun, 20 May 2018 10:52:05 +0800</pubDate><description><![CDATA[func main() {
    a := []int{1, 2, 3}
    b := []int{2, 3, 4, 5, 6}
    a = append(a, b...)
    fmt.Println(a)
}]]></description><category></category></item><item><title><![CDATA[golang map键值互换]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80212898</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80212898</guid><author>MaxCoderLlj</author><pubDate>Sun, 06 May 2018 11:30:46 +0800</pubDate><description><![CDATA[map键值互换

首先想到的方法是构造另一个以原map的key作为value，以原map value为key的map，然后用for-range遍历原map并导入新map。



v1版

var (
    o = map[string]int{&quot;a&quot;: 0, &quot;b&quot;: 0, &quot;c&quot;: 2}
)

func main() {

    fmt.Println(o)

    n := map[in...]]></description><category></category></item><item><title><![CDATA[golang 闭包 闭包实现斐波那契数列]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80211928</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80211928</guid><author>MaxCoderLlj</author><pubDate>Sun, 06 May 2018 09:49:23 +0800</pubDate><description><![CDATA[the way to go小练习——闭包实现斐波那契数列

func fib() func() int {
    var a int = 0
    var b int = 1
    return func() int {
        c := a
        a = b
        b = a + c
        return c
    }
}

func main() {...]]></description><category></category></item><item><title><![CDATA[golang 中的nil]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80199868</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80199868</guid><author>MaxCoderLlj</author><pubDate>Fri, 04 May 2018 20:18:56 +0800</pubDate><description><![CDATA[golang中的nil

nil在Go中相当与其它语言中的NULL、null和None等，使用中表示某一个变量为空。nil只能赋值给指针、channel、func、interface、map或slice类型的变量。如果将nil赋值给其他变量的时候将会引发panic。 

由于Go中interface会同时存储类型和值，如果将一个nil对象赋值给一个interface，这个interface为非ni...]]></description><category></category></item><item><title><![CDATA[golang slice append小坑]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80194077</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80194077</guid><author>MaxCoderLlj</author><pubDate>Fri, 04 May 2018 13:48:35 +0800</pubDate><description><![CDATA[append主要用于给某个切片追加元素

注意  
如果该切片存储空间（cap）足够，就直接追加，长度（len）变长；如果空间不足，就会*重新开辟内存*，并将之前的元素和新的元素一同拷贝进去...]]></description><category></category></item><item><title><![CDATA[golang 函数作为参数传递(回调)]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80191998</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80191998</guid><author>MaxCoderLlj</author><pubDate>Fri, 04 May 2018 10:52:01 +0800</pubDate><description><![CDATA[golang  函数作为参数传递(回调)的例子

和其他很多语言一样，golang中函数也可以作为其它函数的参数进行传递，然后在其它函数内调用执行，一般称之为回调。



语法：以函数签名作为主调函数的形参的类型，即传递一个指向函数的指针



func main() {
    sayhello(&quot;john&quot;, addperfix)
}

func addperfix(perfix, name ...]]></description><category></category></item><item><title><![CDATA[golang 内置函数]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80190673</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80190673</guid><author>MaxCoderLlj</author><pubDate>Fri, 04 May 2018 09:46:30 +0800</pubDate><description><![CDATA[golang 内置函数



Golang有一些不需要进行导入操作即可使用的内置函数，






  函数
  功能



  close
  用于管道通信，关闭chanal


  len、cap
  len 用于返回某个类型的长度或数量（字符串、数组、切片、map 、管道）；cap用于返回某个类型的最大容量（只能用于切片和 map）


  new、make
  new 和 make 均是用...]]></description><category></category></item><item><title><![CDATA[golang defer的执行时机]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80186072</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80186072</guid><author>MaxCoderLlj</author><pubDate>Fri, 04 May 2018 00:00:48 +0800</pubDate><description><![CDATA[golang中defer的执行时机




  官方文档：“A “defer” statement invokes a function whose execution is deferred to the moment the surrounding function returns, either because the surrounding function executed a retu...]]></description><category></category></item><item><title><![CDATA[golang 类型断言]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/80105040</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/80105040</guid><author>MaxCoderLlj</author><pubDate>Fri, 27 Apr 2018 11:03:30 +0800</pubDate><description><![CDATA[golang 类型断言

类型断言是一个使用在接口值上的操作

有时候，我们可能需要知道某个接口类型的实际类型，比如某个方法需要接收多种类型的数据并需做分别处理时，我们可以把形参设为空接口类型以接收任意类型的值，但是我们怎么反向知道里面实际保存了的是哪个类型的对象呢？  
一种常用的方法是： 
• Comma-ok 断言





语法

value,ok := x.(T) 
x表示一个接口的类型...]]></description><category></category></item><item><title><![CDATA[golang 切片去重（1）]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/79947299</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/79947299</guid><author>MaxCoderLlj</author><pubDate>Sun, 15 Apr 2018 10:45:14 +0800</pubDate><description><![CDATA[golang slice去重方法1：通过map键的唯一性去重



func RemoveRep(s []int) []int {
    start := time.Now()
    result := []int{}
    m := make(map[int]bool) //map的值不重要
    for _, v := range s {
        if _, ok := m[v...]]></description><category></category></item><item><title><![CDATA[jQuery实现图片轮播_移入移出]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/64547645</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/64547645</guid><author>MaxCoderLlj</author><pubDate>Tue, 21 Mar 2017 22:19:57 +0800</pubDate><description><![CDATA[html xmlns="http://www.w3.org/1999/xhtml">
head>
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
title>无标题文档title>
head>
style type="text/css">
    *{ margin:0;}
    #flash { widt]]></description><category></category></item><item><title><![CDATA[jquery实现图片轮播_淡入淡出]]></title><link>https://blog.csdn.net/MaxCoderLlj/article/details/63742572</link><guid>https://blog.csdn.net/MaxCoderLlj/article/details/63742572</guid><author>MaxCoderLlj</author><pubDate>Sun, 19 Mar 2017 22:25:15 +0800</pubDate><description><![CDATA[&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;
&amp;lt;title&amp;gt;轮播&amp;lt;/title&amp;gt;




&amp;lt;style]]></description><category></category></item></channel></rss>