Answers to the Most Common Questions We Get Regarding Spam
How Not To Code
by Phillip Bowman
2M ago
These days, phone call and text spam has become an… Read more The post Answers to the Most Common Questions We Get Regarding Spam appeared first on Coding School ..read more
Visit website
C#
How Not To Code
by Phillip Bowman
4M ago
C# programming language can be called one of the most… Read more The post C# appeared first on Coding School ..read more
Visit website
C/ C++
How Not To Code
by Phillip Bowman
4M ago
We will teach you all the basics of algorithmic thinking,… Read more The post C/ C++ appeared first on Coding School ..read more
Visit website
DuckStation
How Not To Code
by hownot2code
10M ago
BUG OF THE MONTH | Free of Pointer not at Start of Buffer V726 An attempt to free memory containing the ‘wbuf’ array by using the ‘free’ function. This is incorrect as ‘wbuf’ was created on stack. log.cpp 216 template<typename T> static ALWAYS_INLINE void FormatLogMessageAndPrintW(....) { .... wchar_t wbuf[512]; wchar_t* wmessage_buf = wbuf; .... if (wmessage_buf != wbuf) { std::free(wbuf); } if (message_buf != buf) { std::free(message_buf); } .... } Here the analyzer detected code with an error. In this code fragment, we see an attempt to delete an ..read more
Visit website
Bitwarden
How Not To Code
by hownot2code
10M ago
BUG OF THE MONTH | Erroneous postfix private async Task<HttpResponseMessage> CallFreshdeskApiAsync( HttpRequestMessage request, int retriedCount = 0) { try { request.Headers.Add("Authorization", _freshdeskAuthkey); var response = await _httpClient.SendAsync(request); if ( response.StatusCode != System.Net.HttpStatusCode.TooManyRequests || retriedCount > 3) { return response; } } catch { if (retriedCount > 3) { throw; } } await Task.Delay(30000 * (retriedCount + 1)); return await CallFreshdeskApiAsync(reques ..read more
Visit website
Blend2D
How Not To Code
by hownot2code
10M ago
BUG OF THE MONTH | An always-false expression V547 Expression ‘h == 0’ is always false. jpegcodec.cpp 252 BLResult blJpegDecoderImplProcessMarker(....) noexcept { uint32_t h = blMemReadU16uBE(p + 1); // ....if (h == 0) return blTraceError(BL_ERROR_JPEG_UNSUPPORTED_FEATURE); // .... impl->delayedHeight = (h == 0); // <=// .... } In this code fragment, the result of the blMemReadU16uBE function call is assigned to the h variable. Then if the h == 0 check is true, we exit from the function’s body. During initialization impl->delayedH ..read more
Visit website
Unity
How Not To Code
by hownot2code
10M ago
BUG OF THE MONTH | Assignment to Variable without Use private void Draw(Rect windowRect) { var rect = new Rect(....); .... if (m_NumFilteredVariants > 0) { .... if (m_NumFilteredVariants > maxFilteredLength) { GUI.Label(....); rect.y += rect.height; } } else { GUI.Label(rect, "No variants with these keywords"); rect.y += rect.height; // <= } rect.y = windowRect.height - kMargin - kSpaceHeight – EditorGUI.kSingleLineHeight; // <= .... } V3008 The ‘rect ..read more
Visit website
Barotrauma
How Not To Code
by hownot2code
10M ago
BUG OF THE MONTH | Unnecessary actions V3107 Identical expression ‘power’ to the left and to the right of compound assignment. RelayComponent.cs 150 public override void ReceivePowerProbeSignal(Connection connection, Item source, float power) { .... if (power < 0.0f) { .... } else { if (connection.IsOutput || powerOut == null) { return; } if (currPowerConsumption - power < -MaxPower) { power += MaxPower + (currPowerConsumption - power); } } } The programmer is trying to add MaxPower,  ..read more
Visit website
Mistakes and suspicious code fragments — or how the static analyzer checked .NET 6
How Not To Code
by hownot2code
10M ago
Videos that analyze errors in software projects are an excellent opportunity to practice coding and learn from other people’s mistakes. This time we’ll analyze the .NET 6 source code. Have fun watching this video and coding ..read more
Visit website
Ogre3D
How Not To Code
by hownot2code
10M ago
BUG OF THE MONTH | Incorrect Calculation V1064 The ‘1’ operand of integer division is less than the ‘100000’ one. The result will always be zero. OgreAutoParamDataSource.cpp 1094 typedef Vector<4, Real> Vector4; const Vector4& AutoParamDataSource::getShadowSceneDepthRange(size_t index) const { static Vector4 dummy(0, 100000, 100000, 1/100000); // .... } Here the dummy vector should store floating point numbers. In this case, the constructor receives 4 arguments of the float type. However, there are integer values to the left and right of the divisi ..read more
Visit website

Follow How Not To Code on Feedspot

Continue with Google
Continue with Apple
OR