What is the underlying implementation of operator new in the compiler of VC?

Updated on technology 2024-04-01
10 answers
  1. Anonymous users2024-02-07

    Dizzy, the manager of the fifth level above, seeing that your level is quite high, why don't you give a decent answer? It's like a fortune teller. Nothing.

  2. Anonymous users2024-02-06

    Because the window system is C C++, C C++ can be written in C C++ and can directly manipulate memory.

    So VC++ is very close to the bottom layer of window.

  3. Anonymous users2024-02-05

    I hope everyone will enthusiastically shoot bricks and potatoes to regret!

  4. Anonymous users2024-02-04

    The difficulty with memory leaks is 1The compiler can't find these issues. 2.

    These errors can only be caught at runtime, and they have no obvious symptoms and appear and disappear. 3.It is especially difficult for users of terminal development such as mobile phones.

    Here are three ways to solve memory leaks: For this kind of problem, you need to have good coding habits.

  5. Anonymous users2024-02-03

    In C we have to use the malloc function, because C doesn't have a new operator, but if your compiler is C++, you can use new.

    How to use the malloc function in C:

    1.First, define a long pointer, like this long* pnumber;

    2.Dynamically open up a piece of memory (1000000 long), you can do this malloc(sizeof(long) *1000000); The only parameter to the malloc function is a size t (unsigned long type), which indicates the size of the memory you want to open up, and we want to open up 1000000 long

    3.Returns a void* pointer, which we have to convert to a long* pointer, like this (long*)malloc(...)

    So the program you want is:

    long *pnumber = long*)malloc(sizeof(long) *1000000);

    Once opened, you can use it like an array.

    When you're done using it, be sure to remember to release it, with free, like this free(pnumber);

    It's more convenient to use new.

    **:long* pnumber = new long[1000000];

    When you're done using it, use delete

    like delete pnumnber;

  6. Anonymous users2024-02-02

    new is an operator in C++, which cannot be used in C, where the malloc() or calloc() function should be used to dynamically allocate memory.

    Usage of new:

    long int *p;

    p=new long[100];Allocate 100 long-type units.

  7. Anonymous users2024-02-01

    Here's what a user wants to use to determine the array length by entering n at runtime, and the procedure is as follows:

    However, if the compiler does not support C99, the program will report an error. There should be an error in the .

    #include

    int main()

    3. However, it can be solved by dynamically applying for memory.

    #include

    #include

    int main()

  8. Anonymous users2024-01-31

    long p;

    p=new long[100000];

    I don't know if it will succeed, P is a pointer.

  9. Anonymous users2024-01-30

    First of all, new is an operator that is used to dynamically create heap objects, using the new type name (initial value list).

    mew type name [subscript expression] dynamic object array 1Allocate memory is equivalent to malloc2 in cInstantiates an object, which calls the object constructor.

  10. Anonymous users2024-01-29

    Dynamically allocates memory space and is used in accordance with delete.

    Because sometimes you don't know how much memory you're using, you need to use a temporary declaration.

Related questions
6 answers2024-04-01

It is to convert ** into executable commands of the system.

3 answers2024-04-01

Simple pacal compiler implementation. rar] - This source code is a simple Pascal compiler implementation, implemented with the tools lex and yacc. >>>More

21 answers2024-04-01

Prefix self-addition and suffix self-addition are different, and prefix self-addition is used after self-adding, such as printf("%d,%d",++d,d);Here, although the calculation time is from right to left, when calculating to ++d, the computer explicitly calculates the value of d first and then uses it, and the suffix self-addition uses the additional one, so printf("%d,%d",c,c++) after the compilation result, the printf function uses a value that is 3, because it is used first, which is the result of the compiler's processing. You can only ask the person who designed the compiler in the first place. >>>More

14 answers2024-04-01

Hello about you, this topic should choose a and d (sorry, I think it's correct), first of all, a export inspection of goods, in principle, the implementation of the origin inspection (except for live animals, implemented by the exit port inspection agency) in the place of origin after the inspection is completed, if the customs clearance and the place of origin are the same, the place of origin inspection agency must issue a customs clearance form for goods, if it is inconsistent, the place of origin needs to issue a certificate or voucher for the export of goods to the place of customs clearance in exchange for the "customs clearance of outbound goods", according to this sentence, you can judge b right >>>More

7 answers2024-04-01

You're an accountant.