argra****@users*****
argra****@users*****
2012年 11月 1日 (木) 20:33:03 JST
Index: docs/perl/5.10.1/perlhack.pod diff -u docs/perl/5.10.1/perlhack.pod:1.2 docs/perl/5.10.1/perlhack.pod:1.3 --- docs/perl/5.10.1/perlhack.pod:1.2 Thu Nov 1 00:22:40 2012 +++ docs/perl/5.10.1/perlhack.pod Thu Nov 1 20:33:02 2012 @@ -2890,13 +2890,11 @@ =end original -Though much can be written about the inconsistency and coverage -problems of gcc warnings (like C<-Wall> not meaning "all the -warnings", or some common portability problems not being covered by -C<-Wall>, or C<-ansi> and C<-pedantic> both being a poorly defined -collection of warnings, and so forth), gcc is still a useful tool in -keeping our coding nose clean. -(TBT) +(C<-Wall> が「全ての警告」を意味しなかったり、C<-Wall> が基本的な移植性問題に +対応していなかったり、C<-ansi> と C<-pedantic> の両方は対応する警告が +貧弱であったり、というような) gcc の警告に関する非一貫性と対応範囲についての +問題点はたくさん書かれてはいますが、gcc は未だにコードをきれいに保つのに +有用なツールです。 =begin original @@ -5774,9 +5772,9 @@ =end original -You cannot portably "stack" cpp directives. For example in the above -you need two separate BURGLE() #defines, one for each #ifdef branch. -(TBT) +移植性のある方法で cpp 指示子を「スタック」させることはできません。 +上述の例では、#ifdef の分岐毎に一つ、計二つの別々の BURGLE() の #define が +必要です。 =item * @@ -5802,10 +5800,9 @@ =end original -The #endif and #else cannot portably have anything non-comment after -them. If you want to document what is going (which is a good idea -especially if the branches are long), use (C) comments: -(TBT) +#endif と #else は、その後ろにコメント以外のものを書くと移植性がありません。 +何をしているかを書いておきたい場合(これは特に分岐が長いときにはよい +考えです)、(C の)コメントを使います: #ifdef SNOSH ... @@ -5820,9 +5817,8 @@ =end original -The gcc option C<-Wendif-labels> warns about the bad variant -(by default on starting from Perl 5.9.4). -(TBT) +gcc オプション C<-Wendif-labels> は悪い変形について警告します +(Perl 5.9.4 からこれはデフォルトです)。 =item * @@ -5832,8 +5828,7 @@ =end original -Having a comma after the last element of an enum list -(TBT) +enum リストの最後の要素の後ろにカンマを付ける enum color { CERULEAN, @@ -5857,9 +5852,8 @@ =end original -Also note that whether enums are implicitly morphable to ints -varies between compilers, you might need to (int). -(TBT) +また、enum が暗黙に int に変換されるかどうかはコンパイラによって異なることに +注意してください; (int) する必要があるかもしれません。 =item * @@ -5881,7 +5875,9 @@ =end original -That is C99 or C++. Perl is C89. Using the //-comments is silently +これは C99 または C++ です。 +Perl は C89 です。 +Using the //-comments is silently allowed by many C compilers but cranking up the ANSI C89 strictness (which we like to do) causes the compilation to fail. (TBT) @@ -5940,9 +5936,9 @@ =end original -That is C99 or C++. While it would indeed be awfully nice to have that -also in C89, to limit the scope of the loop variable, alas, we cannot. -(TBT) +これは C99 または C++ です。 +ループ変数を制限するために C89 でもできれば本当にとてもよいことなのですが、 +悲しいかなそれはできません。 =item * @@ -6046,11 +6042,11 @@ =end original -While this might by accident work in some platform (where IV happens -to be an C<int>), in general it cannot. IV might be something larger. -Even worse the situation is with more specific types (defined by Perl's -configuration step in F<config.h>): -(TBT) +これはいくつかの(IV がたまたま C<int> であるような)プラットフォームでは +偶然動作するかもしれませんが、一般的にはこれはできません。 +IV はもっと大きいかもしれません。 +もっと悪いことに、この状況はより特定の (F<config.h> にある Perl の設定 +ステップで定義される)型です: Uid_t who = ...; printf("who = %d\n", who); /* BAD */ @@ -6107,8 +6103,8 @@ =end original -Also remember that the C<%p> format really does require a void pointer: -(TBT) +C<%p> フォーマットは本当に void ポインタが必要であることも +忘れないでください: U8* p = ...; printf("p = %p\n", (void*)p); @@ -6119,8 +6115,7 @@ =end original -The gcc option C<-Wformat> scans for such problems. -(TBT) +gcc オプション C<-Wformat> はこのような問題をスキャンします。 =item * @@ -6177,8 +6172,7 @@ =end original -Using gcc statement expressions -(TBT) +gcc 文表現を使う val = ({...;...;...}); /* BAD */ @@ -6190,10 +6184,9 @@ =end original -While a nice extension, it's not portable. The Perl code does -admittedly use them if available to gain some extra speed -(essentially as a funky form of inlining), but you shouldn't. -(TBT) +よい拡張ではありますが、移植性がありません。 +Perl コードでは(本質的には変わった形のインラインとして)より速度が +得られる場合には使っているのは確かですが、あなたはするべきではありません。 =item *