Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8406143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:01:17+00:00 2026-06-09T23:01:17+00:00

I think I am clear on the difference between delete and delete []. The

  • 0

I think I am clear on the difference between delete and delete []. The question I am asking here is: sometimes I do have typo and use the wrong one. Then it may or may not crash and normally ends up with hours of debugging.

I wish gcc can detect and give warning on possible misusage on a few simplest cases.
I still have to use “new float[size]” from time to time because of legacy functions that I need to call, so I am more interested in find an error checking tool to catch part of these mistakes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:01:19+00:00Added an answer on June 9, 2026 at 11:01 pm

    I wish gcc can detect and give warning on possible misuage on a few simplest cases.

    Use valgrind.

    I still have to use new float[size] from time to time because of legacy functions that I need to call

    No, you don’t. If a legacy function wants a pointer to the first element of an array of floats, do this:

    std::vector<float> numbers(10);
    legacy_func(&numbers[0]);
    

    Don’t do this:

    float *numbers = new float[10];
    legacy_func(numbers);
    delete[] numbers;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think the question is clear enough but still - what's the difference between:
I think the question title is clear enough: is is possible to stable_sort() a
Based on this question: What is difference between Where and Join in linq? My
I know that the difference between defines and constants is that constants have type,
I have seen some links that tells how to use web client but one
I have seen some links that tells how to use web client but one
I have data where I look at the difference in growth between a monoculture
This is actually a much more concise, much more clear question than the one
Can I have the Information of what is the difference between JSON & GSON.
Is there a difference between Session.Clear() and Session.RemoveAll() ? The descriptions and documentation pages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.