没有合适的资源?快使用搜索试试~ 我知道了~
CodeWarrior C 、C++、汇编语言 编程指南 参考手册
5星 · 超过95%的资源 需积分: 50 80 下载量 168 浏览量
2011-10-27
13:53:11
上传
评论 6
收藏 1.22MB PDF 举报
温馨提示
试读
246页
CodeWarrior C 、C++、汇编语言 编程指南 参考手册 深入浅出CodeWarrior环境编程 适合学习 C或者C++学习 熟悉飞思卡尔单片机汇编指令
资源推荐
资源详情
资源评论
CodeWarrior
®
C, C++, and Assembly
Language Reference
Because of last-minute changes to CodeWarrior, some of the
information in this manual may be inaccurate. Please read the
Release Notes on the CodeWarrior CD for the latest
up-to-date information.
Metrowerks CodeWarrior copyright ©1993–1996 by Metrowerks Inc. and its licensors.
All rights reserved.
Documentation stored on the compact disk(s) may be printed by licensee for personal
use. Except for the foregoing, no part of this documentation may be reproduced or trans-
mitted in any form by any means, electronic or mechanical, including photocopying,
recording, or any information storage and retrieval system, without permission in
writing from Metrowerks Inc.
Metrowerks, the Metrowerks logo, CodeWarrior, and Software at Work are registered
trademarks of Metrowerks Inc. PowerPlant and PowerPlant Constructor are trademarks
of Metrowerks Inc.
All other trademarks and registered trademarks are the property of their respective
owners.
ALL SOFTWARE AND DOCUMENTATION ON THE COMPACT DISK(S) ARE
SUBJECT TO THE LICENSE AGREEMENT IN THE CD BOOKLET.
How to Contact Metrowerks:
U.S.A. and international
Metrowerks Corporation
2201 Donley Drive, Suite 310
Austin, TX 78758
U.S.A.
Canada
Metrowerks Inc.
1500 du College, Suite 300
Ville St-Laurent, QC
Canada H4L 5G6
Mail order
Voice: (800) 377–5416
Fax: (512) 873–4901
World Wide Web
http://www.metrowerks.com
Registration information
register@metrowerks.com
Technical support
support@metrowerks.com
Sales, marketing, & licensing
sales@metrowerks.com
America Online
keyword:
Metrowerks
CompuServe
goto
Metrowerks
C, C++, and Assembly Language Reference
CL–3
Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Overview of the C/C++/ASM Reference . . . . . . . . . . 13
Conventions Used in This Manual . . . . . . . . . . . . . 14
The C/C++ Project Settings Panels . . . . . . . . . . . . . 14
What’s New . . . . . . . . . . . . . . . . . . . . . . . 17
The long long type . . . . . . . . . . . . . . . . . . 17
Turning off register coloring in the 68K compiler . . . . . 17
More information on enumerated types. . . . . . . . . 17
New pragmas . . . . . . . . . . . . . . . . . . . . 17
New intrinsic functions . . . . . . . . . . . . . . . . 18
Improved documentation . . . . . . . . . . . . . . . 18
2 C and C++ Language Notes . . . . . . . . . . . . . . . . . . . . 19
Overview of C and C++ Language Notes . . . . . . . . . . 19
The Metrowerks Implementation of C and C++. . . . . . . . 20
Identifiers . . . . . . . . . . . . . . . . . . . . . . . 21
Include files . . . . . . . . . . . . . . . . . . . . . . 21
The sizeof() operator . . . . . . . . . . . . . . . . . . 22
Register variables . . . . . . . . . . . . . . . . . . . 23
Register coloring. . . . . . . . . . . . . . . . . . . 24
Volatile variables . . . . . . . . . . . . . . . . . . . . 25
Limits on variable sizes . . . . . . . . . . . . . . . . . 26
Declaration specifiers . . . . . . . . . . . . . . . . . . 27
Enumerated types . . . . . . . . . . . . . . . . . . . 28
Number Formats . . . . . . . . . . . . . . . . . . . . . 30
68K Macintosh integer formats . . . . . . . . . . . . . . 30
68K Macintosh floating-point formats . . . . . . . . . . . 32
PowerPC Macintosh, Magic Cap, and Win32/x86 integer formats
33
PowerPC Macintosh and Win32/x86 floating-point formats . 34
Magic Cap Floating-Point Formats . . . . . . . . . . . . 34
Calling Conventions . . . . . . . . . . . . . . . . . . . 35
68K Macintosh calling conventions . . . . . . . . . . . . 35
PowerPC calling conventions . . . . . . . . . . . . . . 36
CL–4
C, C++, and Assembly Language Reference
Magic Cap calling conventions . . . . . . . . . . . . . . 39
Win32/x86 calling conventions. . . . . . . . . . . . . . 39
Extensions to C or C++ . . . . . . . . . . . . . . . . . . 40
ANSI extensions you can’t disable . . . . . . . . . . . . 42
Multibyte characters (Macintosh Only) . . . . . . . . . 43
Declaring variables by address (Macintosh Only) . . . . 43
Opcode inline functions (68K Macintosh Only) . . . . . 43
Inline data (68K Macintosh Only) . . . . . . . . . . . 44
Specifying the registers for arguments (68K Macintosh Only)
45
64-bit integers . . . . . . . . . . . . . . . . . . . . 46
ANSI extensions you disable with ANSI Strict . . . . . . . 47
C++-style comments . . . . . . . . . . . . . . . . . 48
Unnamed arguments in function definitions. . . . . . . 48
A # not followed by argument in macro definition . . . . 48
An identifier after #endif . . . . . . . . . . . . . . . 48
Using typecasted pointers as lvalues . . . . . . . . . . 49
Disabling trigraph characters . . . . . . . . . . . . . . 49
Additional keywords . . . . . . . . . . . . . . . . . . 50
Macintosh and Magic Cap keywords . . . . . . . . . . 50
Win32/x86 keywords. . . . . . . . . . . . . . . . . 51
Enumerated constants of any size . . . . . . . . . . . . 51
Chars always unsigned . . . . . . . . . . . . . . . . . 52
Inlining functions . . . . . . . . . . . . . . . . . . . 52
Using multibyte strings and comments . . . . . . . . . . 53
Using prototypes. . . . . . . . . . . . . . . . . . . . 54
Requiring prototypes. . . . . . . . . . . . . . . . . 54
Relaxing pointer checking. . . . . . . . . . . . . . . 56
Storing strings (Macintosh only) . . . . . . . . . . . . . 56
Pooling strings . . . . . . . . . . . . . . . . . . . 56
Using PC-relative strings . . . . . . . . . . . . . . . 57
Reusing strings . . . . . . . . . . . . . . . . . . . 58
Warnings for Common Mistakes . . . . . . . . . . . . . . 59
Treat warnings as errors . . . . . . . . . . . . . . . . . 60
Illegal pragmas . . . . . . . . . . . . . . . . . . . . 60
Empty declarations . . . . . . . . . . . . . . . . . . . 61
C, C++, and Assembly Language Reference
CL–5
Possible unwanted side effects . . . . . . . . . . . . . . 61
Unused variables. . . . . . . . . . . . . . . . . . . . 62
Unused arguments . . . . . . . . . . . . . . . . . . . 63
Extra commas . . . . . . . . . . . . . . . . . . . . . 64
Extended type checking . . . . . . . . . . . . . . . . . 65
Function hiding . . . . . . . . . . . . . . . . . . . . 66
Generating Code for Specific 68K Processors (Macintosh Only) . 67
Generating code for the MC68020 . . . . . . . . . . . . 70
Generating code for the MC68881 . . . . . . . . . . . . 70
Using the Extended data type . . . . . . . . . . . . . 71
Using floating-point registers . . . . . . . . . . . . . 72
Calling MPW Functions . . . . . . . . . . . . . . . . . . 72
Adding an MPW library to a CodeWarrior project . . . . . 73
Declaring MPW C functions (Macintosh Only) . . . . . . . 75
Using MPW C newlines . . . . . . . . . . . . . . . . . 76
Calling Macintosh Toolbox Functions (Macintosh Only) . . . . 77
Passing string arguments . . . . . . . . . . . . . . . . 78
Using the pascal keyword in PowerPC code . . . . . . . . 79
Intrinsic PowerPC Functions (Macintosh Only) . . . . . . . . 80
Low-level processor synchronization . . . . . . . . . . . 80
Floating-point functions. . . . . . . . . . . . . . . . . 81
Byte-reversing functions . . . . . . . . . . . . . . . . 81
Setting the floating-point environment . . . . . . . . . . 82
Floating-point instructions for the 603 and 604 . . . . . . . 82
Rotating the contents of a variable . . . . . . . . . . . . 83
3 C++ Language Notes . . . . . . . . . . . . . . . . . . . . . . . . 85
Overview of C++ Language Notes . . . . . . . . . . . . . 85
Unsupported Extensions. . . . . . . . . . . . . . . . . . 86
Metrowerks Implementation of C++ . . . . . . . . . . . . 86
Which keywords to put first . . . . . . . . . . . . . . . 87
Additional keywords . . . . . . . . . . . . . . . . . . 87
Conversions in the conditional operator . . . . . . . . . . 87
Default arguments in member functions. . . . . . . . . . 88
Local class declarations with inline functions. . . . . . . . 89
Copying and constructing class objects . . . . . . . . . . 89
剩余245页未读,继续阅读
stlucas76
- 粉丝: 1
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页