jump to navigation

c-faq review and a chinese translation (1.12) February 15, 2007

Posted by TSAI HONG-BIN in Programming.
trackback

please refer to http://c-faq.com/decl/auto.html for original document.

1.12 What’s the auto keyword good for?

Nothing; it’s archaic. [One can imagine stylistic uses such as emphasizing that a variable must be automatic, and supposedly some compilers have used it to force a variable not to be in a register.] (It’s a holdover from C’s typeless predecessor language B, where in the absence of keywords like int a declaration always needed a storage class.) See also question 20.37.

 

關鍵字 auto 有什麼好處

沒有,那已廢棄不用。auto可以做為字面上強調該變數必需為自動(automatic),也許某些編輯器以此來強迫變數不要存放在register裡。C語言的前身B語言沒有類似 int 的關鍵字,因此用auto來做 storage class。

 

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: