You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

指针何时加入C/C++?是否自C语言1979年诞生时便存在?

关于C/C++通用指针的加入时间与历史

Great question! Let's break down the history of generic pointers (what you're referring to as "通用指针", typically void* in modern code) in C and C++ clearly:

C语言中的通用指针

First off, generic pointers weren’t part of the original C language when it emerged around 1979 (the era of the first K&R C, documented in the 1978 The C Programming Language). Back then, programmers used char* as a makeshift generic pointer—since character pointers can point to any memory address, and implicit conversions between char* and other pointer types were allowed without explicit casting.

The standardized void* type, which we now recognize as the official generic pointer, was formally introduced with the ANSI C standard (C89) in 1989. This addition brought safe, consistent generic pointer usage: void* can hold a pointer to any data type, and conversions from void* to other pointer types don’t require explicit casting (though the reverse does, for type safety).

C++中的通用指针

Since C++ evolved directly from C, early versions (like 1985’s Cfront 1.0) inherited the pointer semantics of the K&R C it was built on. That meant programmers could still use char* as a generic pointer in early C++.

Once ANSI C introduced void* in 1989, C++ quickly adopted this feature too. By the time the first official C++ standard (C98) launched, void* was fully integrated as the standard generic pointer type—aligning with C’s behavior while fitting into C’s stricter type system.

To tie this to what you already know:

  • References were added in Cfront 1.0 (1985) as a C++-specific feature
  • Pointers to members came in Cfront 2.0 (1989)
  • Generic pointers (in the standardized void* form) arrived alongside the ANSI C standard, and became a core part of both languages from that point onward.

内容的提问来源于stack exchange,提问作者Streight

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:33:12