2013年9月8日星期日

In Linux , char a, with a + + What are the benefits you ?

I saw a program that is used by the char type data + + define this with an int , then + + What is the difference , what are the advantages or why use a so awkward usage.

char data [100];
data [i] + +;


------ Solution ------------------------------------ --------

Well , mainly space saving, high performance requirements of the program, you can consider so dry , generally not recommended, directly on the line with short
Also need to consider byte alignment problems , 32 4-byte alignment system , high efficiency, 64 8-byte aligned system of high efficiency
------ For reference only --- ------------------------------------
total int it is not necessary to use all < br> ------ For reference only ---------------------------------------
char can be used as an 8-bit int type is used , but less than the int occupies a lot of space .

------ For reference only ---------------------------------------
first data [i] is the character equivalent
char c;
c + +;
and int i;
i + +;
the same , but is char ascii code plus one .
------ For reference only -------------------------------------- -
there is i + + and + + i is not the same , according to the compilers differ , they can test .
------ For reference only -------------------------------------- -
Honestly this way , less seen , typically data [i + +];
------ For reference only ---------------- -----------------------
because a character + + , and no major purpose

没有评论:

发表评论