owenliang
V2EX  ›  C

if you learn c++11, we are not friend anymore.

  •  
  •   owenliang · Sep 13, 2017 · 6105 views
    This topic created in 3339 days ago, the information mentioned may be changed or developed.

    请大家各抒己见。

    47 replies  •  2017-09-27 22:29:34 +08:00
    ryanking8215
    ryanking8215
    Sep 13, 2017
    1
    好几年不用 cpp 的问一下,梗在哪里?
    KaoN
    KaoN
    Sep 13, 2017
    2
    vs2005 飘过。。。
    missdeer
    missdeer
    Sep 13, 2017
    3
    再见!~
    arakashic
    arakashic
    Sep 13, 2017❤️9
    4
    Who care? We WERE not friends.
    enenaaa
    enenaaa
    Sep 13, 2017
    5
    随意,反正 c++11 以上的特性都看不懂。
    lrh3321
    lrh3321
    Sep 13, 2017
    6
    再见!~
    睡不着的时候就翻翻 c++17
    PythonAnswer
    PythonAnswer
    Sep 13, 2017
    7
    es6 啥时候能普及啊,不用转换成 es5 就能直接运行。
    121121121
    121121121
    Sep 13, 2017
    8
    c++20 出来后怎么办?
    ashong
    ashong
    Sep 13, 2017
    9
    c++11 很好用啊, 尤其是 lambda expression 非常方便
    we000
    we000
    Sep 13, 2017❤️1
    10
    大家记得不要交那种认为别人都应该和自己一样想法的"朋友"
    chiu
    chiu
    Sep 13, 2017 via Android
    11
    什么梗,友元函数?
    NullMan
    NullMan
    Sep 13, 2017
    12
    @chiu 噗,友元函数!谁告诉我这又是那个英语术语的翻译?
    congeec
    congeec
    Sep 13, 2017
    13
    @NullMan friend function 咋啦?
    glogo
    glogo
    Sep 13, 2017
    14
    被戳中莫名笑点 233333333
    visionsmile
    visionsmile
    Sep 13, 2017
    15
    @NullMan #12 友元 -> friend
    >A friend of a class is a function or class that is given permission to use the private and protected member names from the class.
    owenliang
    owenliang
    OP
    Sep 13, 2017
    16
    if you think c++11 is good, we end the talk.
    msg7086
    msg7086
    Sep 13, 2017
    17
    @owenliang s/friend/friends/

    @arakashic s/care/cares/
    owenliang
    owenliang
    OP
    Sep 13, 2017
    18
    @msg7086 good job, sed is useful.
    northisland
    northisland
    Sep 13, 2017 via iPhone
    19
    If you think c++11 sucks, go play C++99 without libboost.😜😜😜
    owenliang
    owenliang
    OP
    Sep 13, 2017
    20
    @enenaaa c++11 brings us more pain than happiness.
    owenliang
    owenliang
    OP
    Sep 13, 2017
    21
    @northisland no boost at all, c++03 means c with class and STL for me, which are really meaningful.
    pezy
    pezy
    Sep 13, 2017
    22
    能先说说 C++11 带给你什么 pain 了么?
    AngelCriss
    AngelCriss
    Sep 13, 2017 via Android❤️2
    23
    对,我现在都用的 C++17。
    owenliang
    owenliang
    OP
    Sep 13, 2017
    24
    i don't know what i am doing when using c++11, this feeling is really bad for me.
    owenliang
    owenliang
    OP
    Sep 13, 2017
    25
    @AngelCriss cool, man.
    meecle
    meecle
    Sep 13, 2017
    26
    最近重拾 c++, 已经没有几年前那种恐惧感了,如 c++创始人说,c++是一门严肃的语言。它让你感到痛苦,恐惧,不是它自身的问题,只是把原始的东西给你呈现出来了而已。
    为了克服恐惧感甚至喜好问题, 你可以选择任何符合你口味的语言,但一定要明白你只是选择不去了解这些而已,不代表原始的东西不存在。
    owenliang
    owenliang
    OP
    Sep 13, 2017
    27
    @meecle doesn't c++11 terrified you ?
    owenliang
    owenliang
    OP
    Sep 13, 2017
    28
    I dived into c ++ 8 years ago, but I still can not persuade myself to learn c ++ 11.
    meecle
    meecle
    Sep 13, 2017
    29
    @owenliang 恐惧,但是这个恐惧不是来自 c++,而是计算机本身( os, compiler.....),这么说可能你不相信
    seeker
    seeker
    Sep 13, 2017
    30
    用 c++11 的特性几年了
    daimao
    daimao
    Sep 13, 2017 via iPhone
    31
    c++17 都出了,竟然 11 都不用… 相比阁下还在用 XP 吧?

    PS:看楼上几位用英文尬聊真是尴尬无比
    owenliang
    owenliang
    OP
    Sep 13, 2017
    32
    @daimao Is there any feature we have to use in c++11? and what if without c++11?
    meecle
    meecle
    Sep 13, 2017
    33
    @owenliang 你这么问,问题就跑偏了,我们有必要用 c++么? 如果没有 c++会怎样?
    Athrob
    Athrob
    Sep 13, 2017
    34
    来练习下英语阅读理解
    owenliang
    owenliang
    OP
    Sep 13, 2017
    35
    @meecle no, what we discus is c++ iteself.
    daimao
    daimao
    Sep 13, 2017 via iPhone
    36
    @owenliang 没有,毕竟都是图灵完全的,只不过差「几行」代码量而已。
    zmj1316
    zmj1316
    Sep 13, 2017
    37
    C++ 17 才有的 if constexpr,比 C++ 11 的 enable_if 高到不知哪里去了,坐等支持 C++ 17
    Em5O7B1JGfjQnBry
    Em5O7B1JGfjQnBry
    Sep 13, 2017 via Android
    38
    @owenliang
    0. 移动语义,大内存堆上的对象,没有移动语义以为着你要么到处深复制,要么到处跑指针,频繁的深复制性能不行,到处跑指针,没有智能指针析构会很麻烦,难以避免悬空指针,没有 std::optional 意味着你要养成每次使用指针判断的好习惯,不然无法避免空指针。
    1. auto,当然如果你喜欢每次把写一串模板信息来声明一个迭代器,并且喜欢每次看代码的时候认那一坨东西,我也无话可说:)
    2. foreach,解决下标索引不小心逻辑错误的情况
    3. override,虚函数没写对的情况

    。。。。。

    哇不想列了,再不想要讨论这种事情了,总结一下就是,如果你是写代码不会犯错的神,那么那些东西对你都没用,可惜不是,所以 C++的进化在于,让你用更少的代码,在不牺牲性能的情况下,写出更容易正确的程序。
    Em5O7B1JGfjQnBry
    Em5O7B1JGfjQnBry
    Sep 13, 2017 via Android
    39
    @zmj1316 不用等啊,可以直接用了 constexpr if 了,主流编译器都支持了,我已经用 constexpr if 替换掉之前用 enable_if 写的一坨坨的代码了
    liuminghao233
    liuminghao233
    Sep 13, 2017 via iPhone
    40
    auto+ template 简直是 666
    NullMan
    NullMan
    Sep 13, 2017
    41
    @congeec @visionsmile 果真还是英文术语好懂,一眼就看出是个啥了。
    owenliang
    owenliang
    OP
    Sep 13, 2017 via Android
    42
    zmj1316
    zmj1316
    Sep 13, 2017
    43
    @svenFeng 貌似要 VS 2017 才有,我们这还没几个人装了 17 的...要是用了别人就没法编译了...
    lrxiao
    lrxiao
    Sep 13, 2017
    44
    variadic template parameter
    unordered_
    shihira
    shihira
    Sep 14, 2017
    45
    if C++11 sucks, all C++ standards suck.

    但是我能理解你,可能就是一种玩游戏加了太多 mod 然后觉得玩起来不原汁原味赢了心情也不好的感觉。
    owenliang
    owenliang
    OP
    Sep 14, 2017
    46
    @daimao 酷。
    @zmj1316 酷。
    @shihira 是这种 suck 的感觉。
    yorTX9t
    yorTX9t
    Sep 27, 2017
    47
    But I have been using c++17 for quite a long time......
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1439 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 94ms · UTC 22:43 · PVG 06:43 · LAX 14:43 · JFK 17:43
    ♥ Do have faith in what you're doing.