亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? appc.htm

?? 21天學會用java開發網絡游戲 這對于 想學java編程的人會很有用
?? HTM
字號:
<HTML>

<HEAD>
   <TITLE>appendix C -- Differences Between Java and C/C++</TITLE>
   <META>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<H1><FONT COLOR=#FF0000>appendix C</FONT></H1>
<H1><B><FONT SIZE=5 COLOR=#FF0000>Differences Between Java and C/C++</FONT></B>
</H1>
<P>
<HR WIDTH="100%"></P>
<P>
<H3 ALIGN=CENTER><FONT COLOR="#000000"><FONT SIZE=+2>CONTENTS<A NAME="CONTENTS"></A>
</FONT></FONT></H3>


<UL>
<LI><A HREF="#ThePreprocessor" >The Preprocessor</A>
<LI><A HREF="#Pointers" >Pointers</A>
<LI><A HREF="#StructuresandUnions" >Structures and Unions</A>
<LI><A HREF="#Functions" >Functions</A>
<LI><A HREF="#MultipleInheritance" >Multiple Inheritance</A>
<LI><A HREF="#Strings" >Strings</A>
<LI><A HREF="#ThegotoStatement" >The goto Statement</A>
<LI><A HREF="#OperatorOverloading" >Operator Overloading</A>
<LI><A HREF="#AutomaticCoercions" >Automatic Coercions</A>
<LI><A HREF="#VariableArguments" >Variable Arguments</A>
<LI><A HREF="#CommandLineArguments" >Command-Line Arguments</A>
<LI><A HREF="#Summary" >Summary</A>
</UL>
<HR>
<P>
It is no secret that the Java language is highly derived from
the C and C++ languages. Because C++ is currently one of the more
popular game programming languages, it is important to understand
the aspects of C++ that Java inherits. Of possibly even more importance
are the aspects of C++ that Java doesn't support. Because Java
is an entirely new language, it was possible for the language
architects at Sun to pick and choose which features from C++ to
implement in Java and how to implement them.
<P>
The focus of this appendix is to point out the differences between
Java and C++. If you are a C++ programmer, you can appreciate
the differences between Java and C++. Even if you don't have any
C++ experience, you can gain some insight into the Java language
by understanding the C++ discrepancies that it clears up in its
implementation. If you have a C/C++ game you are thinking of porting
to Java, this appendix will help you sort out the major areas
to target in your porting efforts.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Because C++ backwardly supports C, many of the differences pointed out in this appendix refer to C++, but inherently apply to C as well.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<H2><A NAME="ThePreprocessor"><B><FONT SIZE=5 COLOR=#FF0000>The
Preprocessor</FONT></B></A></H2>
<P>
All C/C++ compilers implement a stage of compilation known as
the preprocessor. Part of the responsibility of the C++ preprocessor
is to perform an intelligent search and replace on identifiers
that have been declared using the <TT><FONT FACE="Courier">#define</FONT></TT>
or <TT><FONT FACE="Courier">#typedef</FONT></TT> directives. Although
most advocators of C++ discourage this usage of the preprocessor,
which was inherited from C, it is still widely used by most C++
programmers. Most of the processor definitions in C++ are stored
in header files, which complement the actual source code files.
<P>
The problem with the preprocessor approach is that it provides
an easy way for programmers to inadvertently add unnecessary complexity
to a program. Many programmers using the <TT><FONT FACE="Courier">#define</FONT></TT>
and <TT><FONT FACE="Courier">#typedef</FONT></TT> directives end
up inventing their own sublanguage within the confines of a particular
project. This results in other programmers having to go through
the header files and sort out all of the <TT><FONT FACE="Courier">#define</FONT></TT>
and <TT><FONT FACE="Courier">#typedef</FONT></TT> information
to understand a program, which makes code maintenance and reuse
almost impossible. An additional problem with the preprocessor
approach is that it is very weak when it comes to type checking
and validation.
<P>
Java does not have a preprocessor. It provides similar functionality
(<TT><FONT FACE="Courier">#define</FONT></TT>, <TT><FONT FACE="Courier">#typedef</FONT></TT>,
and so on) to that provided by the C++ preprocessor, but with
far more control. Constant data members are used in place of the
<TT><FONT FACE="Courier">#define</FONT></TT> directive, and class
definitions are used in lieu of the <TT><FONT FACE="Courier">#typedef</FONT></TT>
directive. The end result is that Java source code is much more
consistent and easier to read than C++ source code. Additionally,
Java programs don't use header files; the Java compiler builds
class definitions directly from the source code files, which contain
both class definitions and method implementations.
<H2><A NAME="Pointers"><B><FONT SIZE=5 COLOR=#FF0000>Pointers</FONT></B></A>
</H2>
<P>
Most developers agree that the misuse of pointers causes the majority
of bugs in C/C++ programming. Put simply, when you have pointers,
you have the ability to trash memory. C++ programmers regularly
use complex pointer arithmetic to create and maintain dynamic
data structures. In return, C++ programmers spend a lot of time
hunting down complex bugs caused by their complex pointer arithmetic.
<P>
The Java language does not support pointers. Java provides similar
functionality by making heavy use of references. Java passes all
arrays and objects by reference. This approach prevents common
errors due to pointer mismanagement. It also makes programming
easier in a lot of ways because the correct usage of pointers
is easily misunderstood by all but the most seasoned programmers.
<P>
You might be thinking that the lack of pointers in Java will keep
you from being able to implement many data structures such as
dynamic arrays. The reality is that any pointer task can be carried
out just as easily, and more reliably, with objects and arrays
of objects. You then benefit from the security provided by the
Java runtime system; it performs boundary checking on all array
indexing operations.
<H2><A NAME="StructuresandUnions"><B><FONT SIZE=5 COLOR=#FF0000>Structures
and Unions</FONT></B></A></H2>
<P>
C++ has three types of complex data types: classes, structures,
and unions. Java only implements one of these data types: classes.
Java forces programmers to use classes when the functionality
of structures and unions is desired. Although this sounds like
more work for the programmer, it actually ends up being more consistent,
because classes can imitate structures and unions with ease. The
Java designers really wanted to keep the language simple, so it
only made sense to eliminate aspects of the language that overlapped.
<H2><A NAME="Functions"><B><FONT SIZE=5 COLOR=#FF0000>Functions</FONT></B></A>
</H2>
<P>
In C, code is organized into functions, which are defaulted as
global subroutines accessible to a program. C++ added classes
and, in doing so, provided class methods, which are functions
that are connected to classes. C++ class methods are very similar
to Java class methods. However, because C++ still supports C,
nothing is discouraging C++ programmers from using functions.
This results in a mixture of function and method use that makes
for confusing programs.
<P>
Java has no functions. Being a more pure object-oriented language
than C++, Java forces programmers to bundle all routines into
class methods. No limitation is imposed by forcing programmers
to use methods instead of functions. As a matter of fact, implementing
routines as methods encourages programmers to better organize
code. Keep in mind that, strictly speaking, nothing is wrong with
the procedural approach of using functions; it just doesn't mix
well with the object-oriented paradigm that defines the core of
Java.
<H2><A NAME="MultipleInheritance"><B><FONT SIZE=5 COLOR=#FF0000>Multiple
Inheritance</FONT></B></A></H2>
<P>
Multiple inheritance is a feature of C++ that enables you to derive
a class from multiple parent classes. Although multiple inheritance
is indeed powerful, it is complicated to use correctly and causes
lots of problems otherwise. It is also very complicated to implement
from the compiler perspective.
<P>
Java takes the high road and provides no direct support for multiple
inheritance. You can implement functionality similar to multiple
inheritance by using interfaces in Java. Java interfaces provide
object method descriptions, but contain no implementations.
<H2><A NAME="Strings"><B><FONT SIZE=5 COLOR=#FF0000>Strings</FONT></B></A>
</H2>
<P>
C and C++ have no built-in support for text strings. The standard
technique adopted among C and C++ programmers is that of using
null-terminated arrays of characters to represent strings.
<P>
In Java, strings are implemented as first class objects (<TT><FONT FACE="Courier">String</FONT></TT>
and <TT><FONT FACE="Courier">StringBuffer</FONT></TT>), meaning
that they are at the core of the Java language. Java's implementation
of strings as objects provides several advantages:
<UL>
<LI>The manner in which you create strings and access the elements
of strings is consistent across all strings on all systems.
<LI>Because the Java string classes are defined as part of the
Java language, and not part of some extraneous extension, Java
strings function predictably every time.
<LI>The Java string classes perform extensive runtime checking,
which helps eliminate troublesome runtime errors.
</UL>
<H2><A NAME="ThegotoStatement"><B><FONT SIZE=5 COLOR=#FF0000>The
</FONT></B><TT><B><FONT SIZE=5 COLOR=#FF0000 FACE="Courier">goto</FONT></B></TT><B><FONT SIZE=5 COLOR=#FF0000>
Statement</FONT></B></A></H2>
<P>
The dreaded <TT><FONT FACE="Courier">goto</FONT></TT> statement
is pretty much a relic these days even in C and C++, but it is
technically a legal part of the languages. The <TT><FONT FACE="Courier">goto</FONT></TT>
statement has historically been cited as the cause for messy,
impossible to understand, and sometimes even impossible to predict
code known as &quot;spaghetti code.&quot; The primary usage of
the <TT><FONT FACE="Courier">goto</FONT></TT> statement has merely
been as a convenience to substitute not thinking through an alternative,
more structured branching technique.
<P>
For all of these reasons and more, Java does not provide a <TT><FONT FACE="Courier">goto</FONT></TT>
statement. The Java language specifies <TT><FONT FACE="Courier">goto</FONT></TT>
as a keyword, but its usage is not supported. I suppose the Java
designers wanted to eliminate the possibility of even using <TT><FONT FACE="Courier">goto</FONT></TT>
as an identifier! Not including <TT><FONT FACE="Courier">goto</FONT></TT>
in the Java language simplifies the language and helps eliminate
the option of writing messy code.
<H2><A NAME="OperatorOverloading"><B><FONT SIZE=5 COLOR=#FF0000>Operator
Overloading</FONT></B></A></H2>
<P>
Operator overloading, which is considered a prominent feature
in C++, is not supported in Java. Although roughly the same functionality
can be implemented by classes in Java, the convenience of operator
overloading is still missing. However, in defense of Java, operator
overloading can sometimes become very tricky. Undoubtedly the
Java developers decided not to support operator overloading in
order to keep the Java language as simple as possible.
<H2><A NAME="AutomaticCoercions"><B><FONT SIZE=5 COLOR=#FF0000>Automatic
Coercions</FONT></B></A></H2>
<P>
<I>Automatic coercion</I> refers to the implicit casting of data
types that sometimes occurs in C and C++. For example, in C++
you are allowed to assign a <TT><FONT FACE="Courier">float</FONT></TT>
value to an <TT><FONT FACE="Courier">int</FONT></TT> variable,
which can result in a loss of information. Java does not support
C++ style automatic coercions. In Java, if a coercion will result
in a loss of data, you must always explicitly cast the data element
to the new type.
<H2><A NAME="VariableArguments"><B><FONT SIZE=5 COLOR=#FF0000>Variable
Arguments</FONT></B></A></H2>
<P>
C and C++ allow you to declare functions that take a variable
number of arguments, such as <TT><FONT FACE="Courier">printf</FONT></TT>.
Although this is a convenient feature, it is impossible for the
compiler to thoroughly type check the arguments, which means problems
can arise at runtime without you knowing it. Again, Java takes
the high road and doesn't support variable arguments at all.
<H2><A NAME="CommandLineArguments"><B><FONT SIZE=5 COLOR=#FF0000>Command-Line
Arguments</FONT></B></A></H2>
<P>
The command-line arguments passed from the system into a Java
program differ in a couple of ways from the command-line arguments
passed into a C++ program. First, the number of parameters passed
differs between the two languages. In C and C++, the system passes
two arguments to a program: <TT><FONT FACE="Courier">argc</FONT></TT>
and <TT><FONT FACE="Courier">argv</FONT></TT>. <TT><FONT FACE="Courier">argc</FONT></TT>
specifies the number of arguments stored in <TT><FONT FACE="Courier">argv</FONT></TT>.
<TT><FONT FACE="Courier">argv</FONT></TT> is a pointer to an array
of characters containing the actual arguments. In Java, the system
passes a single value to a program: <TT><FONT FACE="Courier">args</FONT></TT>.
<TT><FONT FACE="Courier">args</FONT></TT> is an array of <TT><FONT FACE="Courier">Strings</FONT></TT>
that contains the command-line arguments.
<P>
In C and C++, the command-line arguments passed into a program
include the name used to invoke the program. This name always
appears as the first argument, and it is rarely ever used. In
Java, you already know the name of the program because it is the
same name as the class, so there is no need to pass this information
as a command-line argument. Therefore, the Java runtime system
only passes the arguments following the name that invoked the
program.
<H2><A NAME="Summary"><B><FONT SIZE=5 COLOR=#FF0000>Summary</FONT></B></A>
</H2>
<P>
You learned in this appendix about the differences between Java
and C++. Although no knowledge of C++ is required for Java game
programming, it can certainly be beneficial to understand where
Java inherits many of its features.
<P>
<HR WIDTH="100%"></P>

<CENTER><P><A HREF="appb.htm"><IMG SRC="pc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="#CONTENTS"><IMG SRC="cc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="index.htm"><IMG SRC="hb.gif" BORDER=0 HEIGHT=88 WIDTH=140></A></P></CENTER>

<P>
<HR WIDTH="100%"></P>

</BODY>
</HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91久久精品一区二区三区| 久久精品国产秦先生| av激情综合网| 国产精品系列在线| 色综合久久综合网97色综合| 一区二区在线免费观看| 91成人免费在线视频| 亚洲线精品一区二区三区| 欧美日免费三级在线| 日本视频在线一区| 日韩欧美高清一区| 成人一区在线观看| 亚洲综合色婷婷| 日韩欧美一级片| 成人永久免费视频| 亚洲国产精品麻豆| 精品久久久久久久人人人人传媒| 国产精品一区在线观看你懂的| 亚洲国产精品成人综合色在线婷婷| 91论坛在线播放| 日韩高清在线观看| 国产亚洲成aⅴ人片在线观看| 菠萝蜜视频在线观看一区| 亚洲一区二区不卡免费| 欧美成va人片在线观看| 99久久久久免费精品国产 | 成人精品免费网站| 亚洲人午夜精品天堂一二香蕉| 欧美午夜片在线看| 国产盗摄精品一区二区三区在线| 亚洲人成精品久久久久久| 日韩亚洲欧美综合| 91在线你懂得| 韩国av一区二区三区在线观看| 亚洲精品欧美激情| 2019国产精品| 欧美精品 日韩| 99精品久久只有精品| 九九久久精品视频| 一区二区三区产品免费精品久久75| 精品久久久久久最新网址| 色婷婷久久久久swag精品| 精彩视频一区二区三区| 又紧又大又爽精品一区二区| 久久久精品蜜桃| 555夜色666亚洲国产免| 99视频一区二区| 国产精品亚洲人在线观看| 午夜精品在线看| 亚洲美腿欧美偷拍| 国产精品嫩草影院com| 日韩一区二区三区在线视频| 色猫猫国产区一区二在线视频| 精品一区二区三区免费观看| 亚洲一区精品在线| 国产精品福利电影一区二区三区四区| 日韩精品一区二区三区视频播放 | 蜜臀久久99精品久久久画质超高清 | 欧美一区国产二区| 欧美自拍偷拍一区| 99在线精品一区二区三区| 国产在线视频不卡二| 日韩 欧美一区二区三区| 亚洲综合一区二区精品导航| 中文字幕一区不卡| 国产精品国产三级国产普通话99| 欧美精品一区二区三区高清aⅴ | 日韩三级在线观看| 精品视频资源站| 欧美午夜影院一区| 91蝌蚪porny| 94-欧美-setu| 91影院在线免费观看| 9i在线看片成人免费| av电影天堂一区二区在线观看| 国产99久久久精品| 成人午夜激情在线| 成人天堂资源www在线| 国产成人综合精品三级| 国产成人a级片| 成人h版在线观看| 99久久精品一区二区| 99久久er热在这里只有精品15| 99久久精品免费观看| 一本色道**综合亚洲精品蜜桃冫| 91浏览器在线视频| 在线观看日韩一区| 欧美日高清视频| 欧美一区二区三区视频免费播放 | 亚洲成av人影院| 视频在线在亚洲| 美国三级日本三级久久99| 久久se精品一区精品二区| 国产一区二区美女| zzijzzij亚洲日本少妇熟睡| 欧美久久久久久久久中文字幕| 91麻豆精品国产91久久久更新时间 | 欧美军同video69gay| 日韩一区二区三区观看| 久久人人97超碰com| 中文字幕一区二区视频| 亚洲一区二区三区不卡国产欧美| 亚洲综合色区另类av| 免费成人深夜小野草| 国产精品77777竹菊影视小说| 99久久免费精品| 91精品国产色综合久久不卡电影| 欧美一级国产精品| 中文字幕的久久| 亚洲成人av一区二区三区| 久久99精品一区二区三区三区| 成人中文字幕电影| 欧美亚洲国产一区二区三区| 精品裸体舞一区二区三区| 国产精品传媒视频| 久久精品国产久精国产| 北岛玲一区二区三区四区| 7799精品视频| 欧美激情综合五月色丁香小说| 夜夜嗨av一区二区三区中文字幕| 麻豆91免费观看| 一本到不卡精品视频在线观看| 日韩欧美一级片| 一区二区成人在线| 国产一区二区三区蝌蚪| 91影院在线观看| 久久久五月婷婷| 亚洲成人av电影在线| 国产成人精品网址| 9191成人精品久久| 亚洲人被黑人高潮完整版| 精品无人区卡一卡二卡三乱码免费卡| 91麻豆国产香蕉久久精品| 久久先锋影音av| 视频一区视频二区中文字幕| www.亚洲色图| 久久久久亚洲蜜桃| 日韩电影免费在线观看网站| 99精品久久只有精品| 久久久久久99久久久精品网站| 亚洲成人在线网站| 91丝袜美女网| 国产精品女同一区二区三区| 毛片av一区二区三区| 欧美色图在线观看| 中文字幕视频一区| 懂色av一区二区三区免费看| 日韩欧美一区在线| 亚洲妇熟xx妇色黄| 色妞www精品视频| 中文字幕国产精品一区二区| 久久99精品国产91久久来源| 欧美精品v日韩精品v韩国精品v| 一区二区三区四区国产精品| 成人的网站免费观看| 国产午夜久久久久| 国产在线国偷精品免费看| 欧美一级精品在线| 免费成人你懂的| 欧美刺激午夜性久久久久久久| 婷婷中文字幕一区三区| 欧美日韩综合在线| 午夜精品免费在线| 欧美日韩免费高清一区色橹橹 | 狠狠狠色丁香婷婷综合久久五月| 555www色欧美视频| 日韩av在线发布| 91精品婷婷国产综合久久竹菊| 无码av免费一区二区三区试看 | 中文字幕高清一区| 成人免费视频网站在线观看| 国产日韩欧美精品一区| 国产精品亚洲一区二区三区在线| 欧美精品一区二区三区蜜桃| 狠狠久久亚洲欧美| 国产亚洲一区字幕| 成人黄色免费短视频| 亚洲日本va午夜在线电影| 色狠狠综合天天综合综合| 亚洲女厕所小便bbb| 在线一区二区三区做爰视频网站| 一区二区三区不卡在线观看| 欧美视频日韩视频| 午夜视频久久久久久| 日韩一区二区三区在线观看| 久久精品国产精品青草| 久久久久久麻豆| 国产成人av电影| 亚洲精品视频免费看| 欧美精品一二三| 久久99热这里只有精品| 中文字幕免费不卡| 欧美专区日韩专区| 蜜臀久久久久久久| 国产欧美一区二区在线| 色8久久精品久久久久久蜜| 日本不卡一区二区三区高清视频| 精品对白一区国产伦| 97国产一区二区| 日本成人在线电影网|