問題タブ [promotions]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
2 に答える
903 参照

c++ - When will default argument promotions happen?

In C language, compiler perform default argument promotion when the function called does not have a prototype.

But how about C++? When will default argument promotions happen?

In C++11 standard 5.2.2/7:

When there is no parameter for a given argument, the argument is passed in such a way that the receiving function can obtain the value of the argument by invoking va_arg (18.10). [ Note: This paragraph does not apply to arguments passed to a function parameter pack. Function parameter packs are expanded during template instantiation (14.5.3), thus each such argument has a corresponding parameter when a function template specialization is actually called. —end note ] The lvalue-to-rvalue (4.1), array-to-pointer (4.2), and function-to-pointer (4.3) standard conversions are performed on the argument expression. An argument that has (possibly cv-qualified) type std::nullptr_t is converted to type void* (4.10). After these conversions, if the argument does not have arithmetic, enumeration, pointer, pointer to member, or class type, the program is ill-formed. Passing a potentially-evaluated argument of class type (Clause 9) having a nontrivial copy constructor, a non-trivial move constructor, or a non-trivial destructor, with no corresponding parameter, is conditionally-supported with implementation-defined semantics. If the argument has integral or enumeration type that is subject to the integral promotions (4.5), or a floating point type that is subject to the floating point promotion (4.6), the value of the argument is converted to the promoted type before the call. These promotions are referred to as the default argument promotions.

This paragraph still does not specify when will a default argument promotion happen. This paragraph may talk too much without a clear logic. I strove to outline the logic but failed. I am not familiar with the invoking va_arg.

Hope you help me.

0 投票する
2 に答える
678 参照

java - 「式」による Java タイプの昇格

以下の変数 (b と呼ばれる) は、等号の右側にある唯一のものである場合、式と呼ぶことができますか?

この質問をする理由は、式内の型昇格のトピックのためです。Java がすべてのバイトを int にプロモートすることを理解しています。それが、このコード フラグメントがコンパイルされない唯一の理由ですか? (私はキャストについて知っていることに注意してください。それはこのスレッドのポイントではありません。どうもありがとう。)

編集: ジョンとピーターに感謝します。2 番目の例を使用してこのトピックを見てみましょう。

次のようなことが起こっているというのは本当ですか?

(3 行目) Java はバイトを short に変換します。(4 行目) Java は式 b*2 を int に変換します。

これが正しければ、=b; のように見えます。および =b*2; Javaが異なる方法で処理する「式」です。したがって、 =b; 「expression」は int に変換されず、short に拡張されます。しかし、 =b*2; s というターゲット変数が short であっても、expression は short ではなく int に変換されます。

編集2: また -

3 つの変数はすべて short ですが、s2*s3; 式は int に昇格されるため、コンパイル エラーが発生します。

0 投票する
2 に答える
237 参照

java - Java: 複合代入と式ベースの型昇格

以下の 3 つのビットごとの左シフト コード フラグメントでは、興味深いのは、例 #2 と #3 が Java によって異なる方法で処理されていることです。最後の例 (#3) で、Java が複合代入ステートメントを int にアップグレードしないと決定したのはなぜですか?

答えは、Javaが「インライン」で行うことに関係がありますか。コメントありがとうございます。

0 投票する
1 に答える
2089 参照

jenkins - プロモートされた特定のビルドからアーティファクトをコピーする

私はジェンキンスで2つの仕事をしています。1 番目は「ビルド」という名前で、2 番目は「テスト環境にデプロイ」という名前です。最初のジョブでは、テスターが昇格を手動で設定し、昇格されたビルドのみをデプロイできます。2 番目のジョブで、プロモートされたビルドでコンボボックスを生成する「Promoted Build Parameter」を追加しましたが、このパラメーターの値を「Copy artifact from another project」ビルド ステップに接続できません。では、選択したプロモートされたビルドからアーティファクトをコピーするにはどうすればよいでしょうか?

0 投票する
1 に答える
1092 参照

app-store - スターバックスのように App Store のプロモーション コードをスキャン可能にしますか?

私のアプリは審査中で、スターバックスの「今週のアプリの選択」のようなカードに印刷できるように、スキャン可能なプロモーション コードをいくつか作成しようとしています。彼らはアプリのプロモーション コードをボックスに入れ、アプリ ストア アプリを使用してスキャンできます。私はこれを試してみましたが、うまくいきませんでした。これは、Apple が他のユーザーにこの技術の使用を許可していないためですか、それとも私の画像のサイズが間違っているのですか?

ここに画像の説明を入力

ここに画像の説明を入力