12.07.2015 Views

RealView 编译工具编译器参考指南 - ARM Information Center

RealView 编译工具编译器参考指南 - ARM Information Center

RealView 编译工具编译器参考指南 - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

语 言 扩 展示 例class B;class A{friend B; // is the same as "friend class B"};另 请 参 阅• 第 2-116 页 的 --strict, --no_strict3.5.4 读 / 写 常 数外 部 常 数 的 链 接 说 明 指 示 , 常 数 可 以 动 态 初 始 化 或 具 有 可 变 成 员 。注 意使 用 "C++:read/write" 链 接 仅 对 通 过 --apcs /rwpi 编 译 的 代 码 是 必 需 的 。 如 果 使用 此 选 项 重 新 编 译 现 有 代 码 , 则 必 须 更 改 动 态 初 始 化 或 具 有 可 变 成 员 的 外 部 常数 的 链 接 说 明 。使 用 --apcs /rwpi 选 项 编 译 C++ 不 符 合 ISO C++ 标 准 。 示 例 3-1 中 的 声 明 假 定 x在 只 读 段 中 。示 例 3-1 外 部 访 问extern const T x;extern "C++" const T x;extern "C" const T x;无 法 为 常 数 动 态 初 始 化 x ( 包 括 用 户 定 义 的 构 造 函 数 ), 并 且 T 不 能 包 含 可 变 成员 。 示 例 3-2 中 的 新 链 接 说 明 声 明 x 位 于 读 / 写 段 中 , 即 使 使 用 常 数 对 其 初 始 化 。允 许 动 态 初 始 化 x, 并 且 T 可 以 包 含 可 变 成 员 。 其 他 文 件 中 的 x、y 和 z 定 义 必 须具 有 相 同 的 链 接 说 明 。示 例 3-2 链 接 说 明extern const int z; /* in read-only segment, cannot *//* be dynamically initialized */extern "C++:read/write" const int y; /* in read/write segment *//* can be dynamically initialized */extern "C++:read/write"<strong>ARM</strong> DUI 0348BC Copyright © 2007-2009 <strong>ARM</strong> Limited. All rights reserved. 3-15ID090708Non-Confidential, Unrestricted Access

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!