c ++ – Is the reinterpret_cast punning type really an undefined behavior?

It seems to be widely accepted that typing via Punning réinterpréter_cast is somehow forbidden (strictly speaking, "undefined behavior", ie "behavior for which this International Standard does not impose any requirement", with an explicit note stating that implementations can define the behavior) in C ++. Am I wrong to use the following reasoning for not agreeing, And if so, why?


[expr.reinterpret.cast]/ 11 states:

A glvalue expression T1 can be cast to type "reference to T2"If a pointer-type expression on T1"Can be explicitly converted to the type" pointer on T2"using a réinterpréter_cast. The result refers to the same object as the source glvalue, but with the specified type.[Note:Thisisdirepourleslvaluesuneréférence[Note:Thatisforlvaluesareferencecast[Remarque:c’est-à-direpourleslvaluesuneréférence[ Note:Thatisforlvaluesareferencecastréinterpréter_cast(X) has the same effect as converting * reinterpret_cast(& X) with the integrated And and * operators (and similarly réinterpréter_cast(X)). – end note]No temporary post is created, no copy is created and the builders or conversion functions are not called.

with the footnote:

75) This is sometimes called a type pun.

/ 11 implicitly implies, for example, the restrictions from / 6 to / 10, but is perhaps the most common use (punning). objects) is discussed in [expr.reinterpret.cast]/ 7:

An object pointer can be explicitly converted to an object pointer of a different type. When a value v object pointer type is converted to pointer object type on CV T", the result is static_cast(static_cast(V)).[Note:Conversiond'unevaleurdetype"pointeuren[Note:Convertingaprvalueoftype"pointerto[Remarque:Conversiond’unevaleurdetype“pointeuren[ Note:Convertingaprvalueoftype“pointertoT1"To type" pointer to T2" (or T1 and T2 are types of objects and where the alignment requirements of T2 are not more stringent than those of T1) and return to its original type gives the value of the original pointer. – end note]

Clearly, the goal can not be the conversion to / from pointers or references to emptyas:

  1. the example in / 7 clearly shows that static_cast should be enough in the case of pointers, as do [expr.static.cast]/ 13 and [conv.ptr]/ 2; and
  2. [conversions to] references to empty are prima facie invalid.

Further, [basic.lval]/ 8 states:

If a program tries to access the stored value of an object via a glval value other than one of the following types, the behavior is undefined:

(8.1) the dynamic type of the object,

(8.2) a qualified version CV of the dynamic type of the object,

(8.3) a type similar to the dynamic type of the object,

(8.4) a type that is the signed or unsigned type corresponding to the dynamic type of the object,

(8.5) a type that is the signed or unsigned type corresponding to a qualified version of CV of the dynamic type of the object,

(8.6) a type of aggregate or union that includes one of the above types among its elements or non-static data members (including, on a recurring basis, an element or member of non-static data of a sub-aggregated or confined union),

(8.7) a type which is a type of base class (possibly qualified cv) of the dynamic type of the object,

(8.8) a type of character, an unsigned character or a std :: byte type.

And if we go back to [expr.reinterpret.cast]/ 11 for a moment, we see "The result refers to the same object as a glvalue source, but with the specified type"This reads to me as an explicit statement that the result of réinterpréter_cast(V) is an lvalue reference to an object Of type T, to which the access is clearly "by a value glvalue of" "the dynamic type of the object". This sentence also addresses the argument that various paragraphs of [basic.life] apply through the false allegation that the results of these conversions relate to a new object-type T, whose life has not yet begun, who just happen reside at the same memory address as v.

It seems absurd to explicitly set such conversions only to ban standard changes. use of results, in particular in the light of footnote 75 noting that [reference] the conversion is "sometimes called type pun. "

Note that my references refer to the final draft publicly available for C ++ 17 (N4659), but that the language in question is little modified from N3337 (C ++ 11) to N4788 (C ++ 20 WD) (link tip will probably reference to subsequent projects over time). In fact, the footnote to [expr.reinterpret.cast]/ 11 is even more explicit in the most recent version:

This is sometimes called a type pun when the result refers to the same object as the source glvalue.

magento2.3 – Export as csv with an undefined index UiComponentFactory.php

I used the code below in the view:


            
                
                    pos_outlet_listing.pos_outlet_listing.pos_outlet_columns.ids
                
            

You have an error:

Notice: Undefined index: attributes in /home/yaboow/public_html/demo/vendor/magento/framework/View/Element/UiComponentFactory.php on line 176

version 2.3

Is there anything I missed !!?

magento2 – undefined constant MCRYPT_RIJNDAEL_256 – assumed 'MCRYPT_RIJNDAEL_256

I deploy to an ec2 instance and get the following error:

    exception 'Exception' with message "Note: use of the undefined constant MCRYPT_RIJNDAEL_256 - Assumed & # 39; MCRYPT_RIJNDAEL_256 in /var/www/html/yourParts/lib/internal/Magento/Framework/Encryption/Encryptor.php on line

although the mcrypt extension is installed and enabled

jasmine – Randomly broken angular tests: "TypeError not captured: you have specified" undefined "where a stream was expected."

we have a medium-sized angular application with currently about 700 unit tests.
A few weeks ago, perfectly fine tests began to break. Even more strange: running the tests twice can give different results, that is, different tests may fail.
The error "Uncaught TypeError: you indicated" undefined "where a feed was expected is still found in the console." but the trace of the stack gives no indication of the actual location of the root of the error (see end of this article). The stack trace shows a connection to the mergeMap operator, but it turns out that we do not use this operator anywhere in our application and nowhere in our tests.

I went through all the specification files and let them run by themselves (with fdescribe). Each specification file passes without error. Running them all together leads to the case described.

Of course, I imagined that we were facing an asynchronous problem, so I tried to review all the tests and integrate them into an asynchronous environment. I've also verified that each subscription was unsubscribed at one time – this was the case for our application but not always for our tests.
However, the error still persists.

This is a big problem for our project. Any advice is welcome.
Maybe someone knows a way to locate the part of our tests that causes the problem?

We now use jasmine 3.3.0, karma v3.1.4 and Angular 7.1.3.
We updated jasmine and angular a week ago because we were hoping to get rid of it. Only one thing changed: before the update, the tests would not interrupt the tests randomly, but at a fixed number of tests (in our case, 639 tests would cause the break of a test, 638, 640, 641 … etc. would pass, 648 would break again). I guess it has something to do with the random seed that jasmine uses now.

Here is the complete stack trace:

Uncaught TypeError: You specified 'undefined & # 39; where a flow was expected. You can provide an Observable, Promise, Array, or Iterable element.
at subscribeTo (: 9876 / _karma_webpack_ / webpack: /node_modules/rxjs/_esm5/internal/util/subscribeTo.js: 41)
at subscribeToResult (: 9876 / _karma_webpack_ / webpack: /node_modules/rxjs/_esm5/internal/util/subscribeToResult.js: 11)
at MergeMapSubscriber.push ../ node_modules / rxjs / _esm5 / internal / operators / mergeMap.js.MergeMapSubscriber._innerSub (: 9876 / _karma_webpack_ / webpack: / node_modules / rxjs / _esm5
at MergeMapSubscriber.push ../ node_modules / rxjs / _esm5 / internal / operators / mergeMap.js.MergeMapSubscriber._tryNext (: 9876 / _karma_webpack_ / webpack: / node_modules / rxjs / _esm5
at MergeMapSubscriber.push ../ node_modules / rxjs / _esm5 / internal / operators / mergeMap.js.MergeMapSubscriber._next (: 9876 / _karma_webpack_ / webpack: / node_modules / rxjs / _esm5 /
at MergeMapSubscriber.push ../node_modules / rxjs / _esm5 / internal / subscriber.js.Subscriber.next (: 9876 / _karma_webpack_ / webpack: /node_modules/rxjs/_esm5/internal/subscriber.js: 54)
at Observable._subscribe (: 9876 / _karma_webpack_ / webpack: /node_modules/rxjs/_esm5/internal/util/subscribeToArray.js: 5)
at Observable.push ../ node_modules / rxjs / _esm5 / internal / Observable.js.Observable._trySubscribe (: 9876 / _karma_webpack_ / webpack: /node_modules/rxjs/_esm5/internal/Observable.js: 43)
at Observable.push ../ node_modules / rxjs / _esm5 / internal / Observable.js.Observable.subscribe (: 9876 / _karma_webpack_ / webpack: /node_modules/rxjs/_esm5/internal/Observable.js: 29)
at MergeMapOperator.push ../node_modules / rxjs / _esm5 / internal / operators / mergeMap.js.MergeMapOperator.call (: 9876 / _karma_webpack_ / webpack: / node_modules / rxjs / _esm5 / internal / operator / merge
at _____________________Elapsed_3_ms__At__Thu_Dec_27_2018_10_03_35_GMT_0100__Mitteleurop_ische_Normalzeit_ ()
on Object.onScheduleTask (: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone-testing.js: 108)
on ZoneDelegate.push ../node_module / zone.js / dist / zone.js.ZoneDelegate.scheduleTask (: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone.js: 401)
on Object.onScheduleTask (: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone.js: 297)
on ZoneDelegate.push ../node_module / zone.js / dist / zone.js.ZoneDelegate.scheduleTask (: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone.js: 401)
on Zone.push ../node_modules / zone.js / dist / zone.js.Zone.scheduleTask (: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone.js: 232)
on Zone.push ../node_modules / zone.js / dist / zone.js.Zone.scheduleMacroTask (: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone.js: 255)
at scheduleMacroTaskWithCurrentZone (: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone.js: 1114)
at: 9876 / _karma_webpack_ / webpack: /node_modules/zone.js/dist/zone.js: 2090

php – TypeError: answer[0] is undefined

It's okay?

I have this code:

$ (". validateIdProduct"). change (function () {

$ (". alert"). remove ();

var idProduct = $ (this) .val ();
// console.log ("ProductID", ProductID)

var data = new FormData ();
data.append ("validateIdProduct", ProductID);

$ .ajax ({
url: app + "ajax / archivoencuestion.php",
method: "POST",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: "json",
success: function (answer) {

if (answer[0]["id"].length! = 0 && answer[0]["id_administrador"]    ! = id_tienda) {
$ (". validateIdProduct"). parent (). parent (). after (& # 39;
This publication does not belong to you but comes from another seller. Check the ID.
& # 39;); $ (". validateIdProduct"). val (""); } else if (answer[0]["id"].length! = 0 && answer[0]["id_administrador"] == id_tienda) { / * then that's fine ... * / } } }) })

In other words, what I do is bring a table from the database.
Goes 10, brings it and if it finds a match (if this identifier is found in the database) but if it comes from another seller, I receive an alert telling him that it belongs to another seller . If this identifier exists but the publication is yours and not another, it will not execute anything (if not) but if this identifier does not even exist, I get it:

In Firefox Developer Edition: "TypeError: response[0] is undefined. "

Under Chrome: "TypeError Not Captured: Can not Read Property" id of Indefinite "

The answer I receive is: table (0) {}

How can I do with another if I recognize that table (0) {} then run a sentence? I mean, how can I express it?

javascript – Error $ undefined (Uncaught Reference Error: $ is not set to sendDataAjax)

addRowDT function (data) {
var table = $ (# tbl_patients & # 39;). DataTable ();
for (var i = 0; i <data.length; i ++) {
tabla.fnAddData ([
            data[i].Id Patient,
the data[i].Noms,
(data[i].ApPaterno + "" + data[i].ApMaterno)
((Data[i].Sexo == M & # 39;) "Male Female"),
the data[i]Age
the data[i].Address,
((Data[i].State == true)? "Active": "Inactive")
])
}
}

function sendDataAjax () {
$ .ajax ({
type: "POST",
url: "ManagePaciente.aspx / ListPaciente",
data: {},
contentType: application / json; character set = utf-8 & # 39;
error: function (xhr, ajaxOptions, thrownError) {
console.log (xhr.status + " n" + xhr.responseText, " n" + thrownError);
}
success: function (data) {
addRowDT (data.d);
}
});
}

// Call the ajax function when loading the document
sendDataAjax ();
        
        

List of patients

Code names Last name Sex Age address stock

Fatal Error: Uncaught Error: invoking the undefined method log ()

click add product launch error

When I click Add Product, the above error appears. Can any one help me on this how to solve?

json – Javascript object still undefined

var cat_t = & # 39; cat_2 & # 39 ;;
console.log (cat_t);
var raw_services = & # 39; {"services_name": {"cat_4":[], "cat_2":[{“service_id”:”272″,”cat_id”:”2″,”price”:”0.5″,”min”:”100″,”max”:”1000000″,”services_list_type”:1,”symbol”:”u20b9″},{“service_id”:”275″,”cat_id”:”2″,”price”:”1″,”min”:”10000″,”max”:”10000000″,”services_list_type”:1,”symbol”:”u20b9″}]}} & # 39 ;;
var services = JSON.parse (raw_services);
if (typeof services.services_name! == & # 39; undefined & # 39;) {
var s_array = service_service_name;
console.log (s_array.cat_t);
console.log (s_array);
}other{
}

my object of services is services.services_name. When I try to catch his any object, he always says indefinite. here is my jsbin. Please have where I am wrong in it.

plugin development – wordpress get message widget Fatal error: Uncaught error: undefined function call convert_to_screen ()

it's my init.php coding

scheduling function_widget ($ args) {
require_once (ABSPATH. & # 39; wp-admin / includes / class-wp-list-table.php & # 39;);
extract ($ args);
echo $ before_widget;
echo $ before_title;
echo's Computer Science Scheduling Plugin & # 39 ;;
echo $ after_title;
echo widget ();
echo $ after_widget;

}

scheduling function_init () {
require_once (ABSPATH. & # 39; wp-admin / includes / class-wp-list-table.php & # 39;);
wp_register_sidebar_widget ('scheduling_widget_plugin', 'College scheduling', 'scheduling_widget', array (description => & # 39; => & # 39; planning plugin! &);));
}

add_action (& # 39; plugins_loaded & # 39; scheduling_init & # 39;);

register_activation_hook (FOLDER, & # 39; scheduling_create_table & # 39;);
// menu items
add_action (& # 39; admin_menu & # 39; scheduling_modifymenu & # 39;);
scheduling function_modifymenu () {

// this is the main element of the menu
add_menu_page ('Schedule Widget', // page title
& # 39; Planning Widget & # 39 ;, // menu title
& # 39; manage_options & # 39 ;, capabilities
& # 39; widget & # 39 ;, menu slug
& # 39; widget & # 39; // function
)

// this is a submenu
add_submenu_page (& # 39; widget), // parent slug
& # 39; Schedule & # 39; // title of the page
& # 39; Schedule & # 39 ;, // menu title
& # 39; manage_options & # 39 ;, capacity
& # 39; add_adwal_list & # 39; // slug menu
& # 39; add_adwal_list & # 39;); // function


add_submenu_page (null, // slug parent
& # 39; Subject Data & # 39; // title of the page
& # 39; Subject Data & # 39 ;, // menu title
& # 39; manage_options & # 39 ;, capacity
& # 39; Tambah_jadwal_matakuliah & # 39 ;, // slug menu
& # 39; Tambah_jadwal_matakuliah & # 39;); // function

add_submenu_page (null, // slug parent
& # 39; Add calendar & # 39; // title of the page
& # 39; Add calendar & # 39; // menu title
& # 39; manage_options & # 39 ;, capacity
& # 39; Planning_additional scheduling & # 39 ;, // menu slug
& # 39; schedule_additional scheduling & # 39;); // function

add_submenu_page (& # 39; widget & # 39;
"Speaker",
"Speaker",
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, add_doctor_list
& # 39; add_doctor_list & # 39;);

add_submenu_page (null,
& # 39; Add a speaker & # 39;
& # 39; Add a speaker & # 39;
& # 39; & # 39 ;, manage_options
& # 39; scheduling of the teacher teacher & # 39 ;,
"Teacher schedule");

add_submenu_page (& # 39; widget & # 39;
"Bedroom",
"Bedroom",
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, add_ruangan_list
& # 39; add_ruangan_list & # 39;);

add_submenu_page (null,
& # 39; Add a room & # 39 ;,
& # 39; Add a room & # 39 ;,
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, scheduling_ruangan_ruangan
& # 39; scheduling_addition_ruangan & # 39;);

add_submenu_page (& # 39; widget & # 39;
& # 39; & # 39 ;, Course
& # 39; & # 39 ;, Course
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, scheduling_list_tahun_ajaran
& # 39; schedule_list_tahun_ajaran & # 39;);

add_submenu_page (null,
& # 39; Add the school year & # 39 ;,
& # 39; Add the school year & # 39 ;,
& # 39; & # 39 ;, manage_options
& # 39; scheduling annual_department & # 39 ;,
& # 39; additional annual calendar & # 39;);

add_submenu_page (null,
"List of Academic Years",
"List of Academic Years",
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, added_matakuliah_list
& # 39; added_matakuliah_list & # 39;);

add_submenu_page (null,
& # 39; Add a class & # 39 ;,
& # 39; Add a class & # 39 ;,
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, scheduling_address_machine
& # 39; scheduling_machine_message & # 39;);

add_submenu_page (& # 39; widget & # 39;
"The weather",
"The weather",
& # 39; & # 39 ;, manage_options
& # 39; time_ scheduling & # 39;
"Schedule");

add_submenu_page (null,
& # 39; Add time & # 39 ;,
& # 39; Add time & # 39 ;,
& # 39; & # 39 ;, manage_options
& # 39; additional schedule & # 39 ;,
& # 39; additional scheduling & # 39;);

// this sub menu is hidden, however, we must add it anyway
add_submenu_page (null, // slug parent
& # 39; Schedule Update & # 39; // page title
& # 39; Schedule Update & # 39 ;, // menu title
& # 39; manage_options & # 39 ;, capacity
& # 39; scheduling_update & # 39; // menu slug
& # 39; scheduling_update & # 39;); // function

add_submenu_page (null,
& # 39; Course update & # 39 ;,
& # 39; Course update & # 39 ;,
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, matakuliah_update
& # 39; matakuliah_update & # 39;);

add_submenu_page (null,
"Update Speakers"
"Update Speakers"
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, dosen_update
& # 39; dosen_update & # 39;);

add_submenu_page (null,
"Update room",
"Update room",
& # 39; & # 39 ;, manage_options
& # 39; & # 39 ;, ruang_update
& # 39; ruang_update & # 39;);

}
define (& # 39; ROOTDIR & # 39 ;, plugin_dir_path (FOLDER));
require_once (ROOTDIR. & matakuliah.php & # 39;)
require_once (ROOTDIR. & # 39; Jadwal.php & # 39;);
require_once (ROOTDIR. dosen_pengajar.php);
require_once (ROOTDIR. & # 39; ruang.php & # 39;);
require_once (ROOTDIR. & # 39; widget.php & # 39;);
require_once (ROOTDIR. added_jadwal_list.php;);
require_once (ROOTDIR. & # 39; add_dosen_list.php & # 39;)
require_once (ROOTDIR. added_ruangan_list.php);
require_once (ROOTDIR. added_matakuliah_list.php & # 39;)
require_once (ROOTDIR. & # 39; penjadwalan_update.php & # 39;);
require_once (ROOTDIR. & # 39; matakuliah_update.php & # 39;)
require_once (ROOTDIR. dosen_update.php);
require_once (ROOTDIR. & # 39; ruang_update.php & # 39;);
require_once (ROOTDIR. tahun_ajaran.php);
require_once (ROOTDIR. & # 39; list_tahun_ajaran.php & # 39;)
require_once (ROOTDIR. & # 39; list_matakuliah_jadwal.php & # 39;)
require_once (ROOTDIR. scheduling_time.php);
require_once (ROOTDIR. scheduling_time_time.php);
require_once (ROOTDIR. class-dosen.php & # 39;)
require_once (ROOTDIR. class-widget.php);

and this is my coding table for widgets

function widget () {
?>
/PluginFix(testing2)/css/widget_style.css "rel =" stylesheet "/>

prefix. "calendar";

                $ rows = $ wpdb-> get_results ("SELECT day, name, speaker, space, time from $ table_name order per day desc");
?>
    
Day Name of the course Speaker Hours Bedroom
the day; ?> name?> speaker; ?> the weather; ?> l & # 39; space; ?>
<! -
See all times <a href = ""> Schedule
->
<? php _e ("
"); $ widget_class = new widget_list_class (); $ widget_class -> prepare_items (); $ widget_class -> search_box (& # 39; search & # 39 ;, & # 39; search & # 39;); $ widget_class -> display (); _e ("
");

}

thanks for the help