Thank you so much Peter. This is exactly the kind of code review I really like. I looked at the code you sent and tried to test it. At a first glance I saw a misbehavior.
your code is partition2. list = partition2("TESTING", 2, False) print(list)
list = partition("TESTING", 2, False) print(list) // — The output is different : ['ET', 'TS', 'NI', 'G'] partition2 ['TE', 'ST', 'IN', 'G'] partition
Looking at our coding standard, cases within a switch are always indented. Looked also at latest and greatest coding standards online. Please indent all cases across the entire code base. This will make them not only consistent with our C++ coding standard, but also more legible and compliant with the latest and greatest trends on C++ programming community.
if case of error of casting 4 it doesn't return 0 it returns nothing. To answer the question yes the length of the returned QByteArray is the error identification. In some functions an uninitialized returned object is the way of unsuccessful action like returning null or an empty object.
Wait so in that case mData would be written over with the call: Types::setValue(s32, mData) Then mData is returned, with a length of one. Would the caller know whether the value was correctly converted to 0, or converted to 0 in error in this case?
Should these test scripts even be code reviewed? I view this folder as a play area for developers. I put my name in the file name to help me find my scripts.
If the vData = 0 and is converted from a QVariant::UInt, QVariant::Int, or QVariant::Float to quint32, qint32, or float successfully, how would the caller of fromVariant know whether the value was converted successfully or not?
Say for some (unlikely) reason that vData can't be read or converted properly any longer, and there is an error converting it but not an error in checking its type. If QVariant vData = 4, then you run vData.toInt(&ok) and it's not successful and says 0. How would the caller be able to know there is an error in the conversion just from the message length in this case? int 4 has the same length as int 0.
These are the codes before MVC implementation and Application was using QVariantList. Some of these needs to be removed but needs to be carefully tested(investigated) and removed.
This is just a placeholder. I do not believe this is specified anywhere yet - still unknown - but f/w will need to know this I imagine to determine when the line is cleared.