Your static initializer logic could silently break your class. You define a static property that depends on another static property declared later. Then you log both values. In production the first value becomes NaN, corrupting downstream calculations. Error logs show unexpected numbers, leading to wasted debugging time. Automated tests may miss it if they only check the second property. Comment A, B, C, or D with your reasoning. #typescript #programming #codinginterview #backend
Static Property Initialization Issues in TypeScript
More Relevant Posts
-
Can you predict the behavior of this program? #include<stdio.h> #include<stdlib.h> int main() { int *p; { p = malloc(sizeof(int)*5); for(int i = 0; i < 5; i++) p[i] = i; } free(p); } #c #embeddedc #cprogramming #pointers
To view or add a comment, sign in
-
what is the output of this code snippet? #include<stdio.h> void main() { int a[5]={10,20,30,40}; char *p[3]={a+2,a+1,a}; short int **q=p+1; ++*q; printf("%d\n",q[1][1]); printf("%d\n",q[0][-1]); } #cprogramming #embeddedc #pointers #c
To view or add a comment, sign in
-
A small C++ tip that can save a lot of unnecessary work: std::vector::reserve() Whenever I’m loading data or building vectors from known sources (files, protobufs, APIs, etc.), I try to remember this. #cpp #cplusplus #programming #softwareengineering
To view or add a comment, sign in
-
-
LeetCode Practice: Today I solved Problem no.328(Odd Even Linked List) Statement- We are given the head of a singly linked list , group all the node with odd indices together followed by the node of even indices , and return the reordered list. Approach(Brute Force) Key Idea: I used ana auxiliary array to store the node values 1-Traverse the list by using temp->next->next starting from head to collect the odd indexed nodes 2-Then temp=head->next and traverse it using temp->next->next to collect the even indexed nodes 3-This ensures that all the odd index were stored first followed by even indexed nodes 4- Finally convert the array into the linked list. Time Complexity: O(N) Space Complexity: O(N) (due to the extra array) #LeetCode #DataStructures #LinkedList #CodingPractice #DSA #Programming #ProblemSolving
To view or add a comment, sign in
-
-
LeetCode Parctice: Problem no.217 (Contains Duplicate) Statement- A array is given , we have to return true if any value appears at least twice in the array, and return false if every element is distinct. Approach- Brute Force Key Idea: - I used sets data structure for this problem as set only store unique elements. -While traversing the array, I check whether the current element already exists in the set. If the element is already present → it means a duplicate exists, so return true. Otherwise, insert the element into the set and continue checking. Time Complexity = O(n) Space Complexity = O(n) #DSA #CodingPractice #Cpp #Programming #ProblemSolving
To view or add a comment, sign in
-
-
Time for a C-Programming Deep Dive! Pointers are often where the gap between "knowing" C and "mastering" C becomes clear. Can you predict the exact output of this code without running it in a compiler? The Challenge: #include <stdio.h> int main() { int arr[] = {10, 20, 30, 40, 50}; int *ptr = arr; printf("%d, ", *ptr++); printf("%d, ", *++ptr); printf("%d, ", ++*ptr); printf("%d", (*ptr)++); return 0; } How to participate: Work out the logic for each printf statement. Drop your answer in the comments below. Explain why the third and fourth outputs are particularly tricky! I’ll be liking the correct answers and posting the full technical breakdown of the operator precedence involved in 24 hours. Let's see who gets it 100% right! 🎯 #CProgramming #EmbeddedSystems #VLSI #CodingChallenge #SoftwareEngineering #Pointers #ProgrammingQuiz
To view or add a comment, sign in
-
I was studying the PEB (Process Environment Block); basically, it contains information about a process that the operating system needs to execute it. I implemented this practically. In the PEB structure, there is a member called 'BeingDebugged' which flags whether a process is attached to a debugger. I generated a program that extracts the PEB base address of the assault cube process and uses the BeingDebugged member to check if the process is attached to a debugger or not. I wanted to visually verify at runtime if the base address extracted by the script was correct, so I pasted the base address into Cheat Engine and dissected it. since the offset for BeingDebugged is at 0x02, I manually added +2 to the base address. I wondered what would happen if I froze this address. I did so, and it bypassed the script. after freezing the address, I ran the C++ script and the flag was 0, even though it should have been 1 because x32dbg was attached to the assault cube process. In Cheat Engine, we cannot find this address normally because the Kernel uses it at runtime, not the user. however, we can read this memory by using native APIs. the conclusion is that the PEB is the DNA of a process because the Kernel uses it, and since it exists in user-mode, it makes for an excellent target for reverse engineering. linktree: https://lnkd.in/dUfKKv_d #reverseenginnering #cheatengine #windowsinternals #redteaming #lowlevel #operatingsystem #lowlevel #thought #programming #script
To view or add a comment, sign in
-
Ever faced a memory leak… in code or in life? 😂 Post: In C, forgetting to free() memory leads to leaks. In life, forgetting to “let go” does the same. 🔹 Deleted the node 🔹 But memory still occupied That’s not just a bug… that’s emotional engineering 😄 👉 Lesson: Always clean up your pointers (and your past) #CProgramming #LinkedList #MemoryLeak #CodingHumor #SoftwareEngineering #EmbeddedSystems #DebuggingLife #TechMemes #ProgrammerLife
To view or add a comment, sign in
-
-
Multithreading in theory vs reality 🧵⚙️ In theory: Every thread executes independently, efficiently, and peacefully. In reality: Race conditions, deadlocks, and thread competition, context switching, synchronization issues etc. 👉 Writing multithreaded code is easy. 👉 Writing correct multithreaded code is the real challenge. #Multithreading #Concurrency #Programming #SoftwareEngineering #BackendDevelopment #CPP #CppProgramming #ModernCPP #Multithreading #Concurrency #ParallelProgramming #STL #SystemProgramming #SoftwareEngineering #CodingLife
To view or add a comment, sign in
-
-
Multithreading in theory vs reality 🧵⚙️ In theory: Every thread executes independently, efficiently, and peacefully. In reality: Race conditions, deadlocks, and thread competition, context switching, synchronization issues etc. 👉 Writing multithreaded code is easy. 👉 Writing correct multithreaded code is the real challenge. #Multithreading #Programming #SoftwareEngineering #BackendDevelopment #CPP #CppProgramming #ModernCPP #Multithreading #Concurrency #ParallelProgramming #SystemProgramming #SoftwareEngineering #CodingLife
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development