cpp-learning's People
Forkers
wang1219986995 animfanis123 zeqi1991 liqunliu churchhan lxlyh innovationflash myqlee tristanmooo airkee zhenyazheng mc9529 lichengtao1989 sese53 noel1992 1152545264 wuzhuqingfeng aww3482 ulta-xia zhangji261 wangxiangbozju feitianxiaojuju zhangdangdang gatechcs2020 pcchris1995 shuht wjymath ldd1987 wangyu719 jaegeryan jockyuan zhishuangr habbyge xiuyangleiasp jiangzidong1 foeinlove koi-boy xjsxujingsong ahua199413 isanthree hanyanghyhyhy bourbon-whiskey seulchanson freedom71 jayzhou1024 jjkke88 enigma84822 zjuwangxiangbo rollingkitty qingwenyi tjrlgvgfwwo liuguoyou 1466019971 oeiavo recardomli t2k-pp chineseboyly jerrycatleung dingyi940409 knightoffree qiwei9743 evenader alxemade cursorhu free-dong googlexer l00447754 feiliu94 alex-cao-rnd silentstreet liaura yanqiang-ux hugh-tong que11e cliffjerry senlyu163 shiverzm qazwsx654 henderson11 ycllz 271806 fighting2020 tianyawu8888 xwlan haiyangfenghuo loongsunchan likunyao 276585877 shxjjstianx zhuhaijun753 hpstu coding13 lc790 debugspy marksmith666 jiang-zl hellogxrong enguang2 mawei029 litterfishercpp-learning's Issues
操作系统部分 第三个视频被删除了
C++ 不支持变量长度数组,请不要误导新人
您好。偶然看到您的这一仓库,发现您的 C++数组长度可以为变量吗? 文章中提出了错误的观点。我在这里郑重地告知您:C++ 不支持变量长度数组(VLA)。
简单来说,VLA 是 C 语言的语法,于 1999 年在 C99 标准中引入(并在 2011 年的 C11 中又取消)。但 C++ 直至目前不支持任何 VLA 相关语法。容易引起误会的是,GCC 和 Clang++ 编译器提供了包含 VLA 的GNU 扩展语法,并且默认引入这些扩展。因此,VLA 在这些 C++ 编译器下可行。反之,如果关闭这些扩展(通过添加 -pedantic-errors
选项)或者非 GNU 兼容的编译器(如 MSVC),则 VLA 不可用。
实例测试
GCC 在严格模式下禁止 C++ VLA
Clang++ 在严格模式下禁止 C++ VLA
MSVC 在任何情形下都不允许 C++ VLA
标准文本
In a declaration
T
D
whereD
has the form
D1
[
constant-expression opt]
attribute-specifier-seq optand the type of the contained declarator-id in the declaration
T
D1
is “derived-declarator-type-listT
”, the type of the declarator-id inD
is “derived-declarator-type-list array ofN
T
”. The constant-expression shall be a converted constant expression of typestd::size_t
([expr.const]). Its valueN
specifies the array bound, i.e., the number of elements in the array;N
shall be greater than zero.
取自 C++ 最新标准草案 [dcl.array] 第一段。
其中,注意加粗的文本:(上述语法形式方括号内的)constant-expression 需要是一个经转换后类型为 std::size_t
的常量表达式。
入门可以首先看清华郑莉老师视频 这个视频无了
入门可以首先看清华郑莉老师视频 这个视频无了
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.