由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - From C++ to C
相关主题
recommend assembly code from gccC 和 C++ 相比有什么优点?
码工试题 (转载)static initialization dependency c++
c++ initialize struct大牛给介绍一下Objective C vs C++ 的优劣吧
珍惜生命,远离 R 和 Go一道 memset in C++的题
关于#define 和 structc++ 不自动initialize变量么?
不明白C++的一个地方size不固定的struct怎么定义呀?
请教一下,C++如何判断未初始化的变量how to initialize this struct.
几个C++的问题问个GSL的问题
相关话题的讨论汇总
话题: c++话题: coder话题: write话题: syntax话题: little
进入Programming版参与讨论
1 (共1页)
d****p
发帖数: 685
1
There is so much stuff about how to learn C++ as C coders. Howerver, little
can be found about becoming a
good C coder as a C++ coder.
Anyone cares to offer oponions?
g*****g
发帖数: 34805
2
C is part of C++

little

【在 d****p 的大作中提到】
: There is so much stuff about how to learn C++ as C coders. Howerver, little
: can be found about becoming a
: good C coder as a C++ coder.
: Anyone cares to offer oponions?

t****t
发帖数: 6806
3
for syntax, you may say c++ is a superset of c
but they are totally different language.

【在 g*****g 的大作中提到】
: C is part of C++
:
: little

t****u
发帖数: 8614
4
Nod!
Procedure based vs. OO, the concept is totally different.

【在 t****t 的大作中提到】
: for syntax, you may say c++ is a superset of c
: but they are totally different language.

a****o
发帖数: 686
5
又见 master shifu。

【在 t****t 的大作中提到】
: for syntax, you may say c++ is a superset of c
: but they are totally different language.

l******e
发帖数: 12192
6
原来是这个滴马甲

【在 a****o 的大作中提到】
: 又见 master shifu。
b******n
发帖数: 592
7
I would say they are two different thing, especially from C to c++,
so many assumptions in C is no longer valid in C++.. if you want to
write C++, write it in C++ way..
C is smaller than C++ and quite stable, it is easier to understand what
compiler
does to C program.

【在 g*****g 的大作中提到】
: C is part of C++
:
: little

g*****g
发帖数: 34805
8
C++ doesn't exactly need C syntax in it, but since it does,
real world C++ codes do have lots of C code in it.
As a result, every good C++ coder knows C fairly well.

【在 b******n 的大作中提到】
: I would say they are two different thing, especially from C to c++,
: so many assumptions in C is no longer valid in C++.. if you want to
: write C++, write it in C++ way..
: C is smaller than C++ and quite stable, it is easier to understand what
: compiler
: does to C program.

r*********r
发帖数: 3195
9
做一个合格的 c 程序员, 最重要的是把 posix api 搞熟.
m********l
发帖数: 4394
10
yea...
you have to deal with a lot of limitations.
you need to memorize them.

little

【在 d****p 的大作中提到】
: There is so much stuff about how to learn C++ as C coders. Howerver, little
: can be found about becoming a
: good C coder as a C++ coder.
: Anyone cares to offer oponions?

相关主题
不明白C++的一个地方C 和 C++ 相比有什么优点?
请教一下,C++如何判断未初始化的变量static initialization dependency c++
几个C++的问题大牛给介绍一下Objective C vs C++ 的优劣吧
进入Programming版参与讨论
h***i
发帖数: 1970
11
说superset也不准确,
struc fs_ops
{
.open = fs_open,
.write = fs_write
}
这个C++就不支持。

【在 t****t 的大作中提到】
: for syntax, you may say c++ is a superset of c
: but they are totally different language.

r****o
发帖数: 1950
12
what does .open and .write mean?

【在 h***i 的大作中提到】
: 说superset也不准确,
: struc fs_ops
: {
: .open = fs_open,
: .write = fs_write
: }
: 这个C++就不支持。

t****t
发帖数: 6806
13
that's c99. c99 does have some syntax extension (which c++ doesn't have).
but obviously current c++ standard is before c99. lol
BTW the correct syntax is
struct S s={.open=fs_open, .write=fs_write};

【在 h***i 的大作中提到】
: 说superset也不准确,
: struc fs_ops
: {
: .open = fs_open,
: .write = fs_write
: }
: 这个C++就不支持。

r****o
发帖数: 1950
14
the same as function pointers?

【在 t****t 的大作中提到】
: that's c99. c99 does have some syntax extension (which c++ doesn't have).
: but obviously current c++ standard is before c99. lol
: BTW the correct syntax is
: struct S s={.open=fs_open, .write=fs_write};

d****p
发帖数: 685
15
Looks like .a equivalent to this->a. And suporting partial initializing C
structure? More readable?
First time saw this - that's too much for my poor C knowledge gained 10+
years ago

【在 r****o 的大作中提到】
: the same as function pointers?
a**e
发帖数: 5794
16
C有一些很不方便的地方,比如
1. 没有namespace,函数得用很长的名字。
2. 没有内存管理。
3. 返回一个数组需要malloc,还得返回数组长度,因为数组没有.length或size之类的
属性。
4. 如果一个struct包含flexible array member,不能直接初始化这个struct的数组。
这些问题都可以绕过去,但是绕过去的方法不够优雅。

little

【在 d****p 的大作中提到】
: There is so much stuff about how to learn C++ as C coders. Howerver, little
: can be found about becoming a
: good C coder as a C++ coder.
: Anyone cares to offer oponions?

d****p
发帖数: 685
17
Thank all guys answering my question. Now I have a slightly updated
knowledge on C :-)

【在 a**e 的大作中提到】
: C有一些很不方便的地方,比如
: 1. 没有namespace,函数得用很长的名字。
: 2. 没有内存管理。
: 3. 返回一个数组需要malloc,还得返回数组长度,因为数组没有.length或size之类的
: 属性。
: 4. 如果一个struct包含flexible array member,不能直接初始化这个struct的数组。
: 这些问题都可以绕过去,但是绕过去的方法不够优雅。
:
: little

v*s
发帖数: 946
18
C++貌似也没有内存管理。
除非你要用shared_ptr。

【在 a**e 的大作中提到】
: C有一些很不方便的地方,比如
: 1. 没有namespace,函数得用很长的名字。
: 2. 没有内存管理。
: 3. 返回一个数组需要malloc,还得返回数组长度,因为数组没有.length或size之类的
: 属性。
: 4. 如果一个struct包含flexible array member,不能直接初始化这个struct的数组。
: 这些问题都可以绕过去,但是绕过去的方法不够优雅。
:
: little

v*s
发帖数: 946
19
请教“4” 是啥意思? C++能做吗?

【在 a**e 的大作中提到】
: C有一些很不方便的地方,比如
: 1. 没有namespace,函数得用很长的名字。
: 2. 没有内存管理。
: 3. 返回一个数组需要malloc,还得返回数组长度,因为数组没有.length或size之类的
: 属性。
: 4. 如果一个struct包含flexible array member,不能直接初始化这个struct的数组。
: 这些问题都可以绕过去,但是绕过去的方法不够优雅。
:
: little

d***q
发帖数: 1119
20
the compelling feature of C/C++ is programmer taking over memory management.
so even you use smart pointer you still need to have a knowledge what kind
of smart pointer you need to use: shared_ptr? weak_ptr? intrusive_ptr?
for any language with GC support. these choices will be made easily.

【在 v*s 的大作中提到】
: C++貌似也没有内存管理。
: 除非你要用shared_ptr。

c**b
发帖数: 2999
21
C: procedural language
java: object-orientated language
c++: hybrid of both

little

【在 d****p 的大作中提到】
: There is so much stuff about how to learn C++ as C coders. Howerver, little
: can be found about becoming a
: good C coder as a C++ coder.
: Anyone cares to offer oponions?

1 (共1页)
进入Programming版参与讨论
相关主题
问个GSL的问题关于#define 和 struct
python 超级难题求救不明白C++的一个地方
c++ size_t 一问请教一下,C++如何判断未初始化的变量
三个C syntax 弱问题几个C++的问题
recommend assembly code from gccC 和 C++ 相比有什么优点?
码工试题 (转载)static initialization dependency c++
c++ initialize struct大牛给介绍一下Objective C vs C++ 的优劣吧
珍惜生命,远离 R 和 Go一道 memset in C++的题
相关话题的讨论汇总
话题: c++话题: coder话题: write话题: syntax话题: little