Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  TestCustomHeap.cpp

  Sprache: C
 

#define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
#ifndef MOZ_HEAP_ALLOCATOR
#define MOZ_HEAP_ALLOCATOR \
  _Pragma("GCC diagnostic push") \
  _Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
  __attribute__((annotate("moz_heap_allocator"))) \
  _Pragma("GCC diagnostic pop")
#endif

#include <stdlib.h>
#include <memory>

struct MOZ_NONHEAP_CLASS X {
};

void *operator new(size_t x, int qual) MOZ_HEAP_ALLOCATOR {
  return ::operator new(x);
}

template <typename T>
T *customAlloc() MOZ_HEAP_ALLOCATOR {
  T *arg =  static_cast<T*>(malloc(sizeof(T)));
  return new (arg) T();
}

void misuseX() {
  X *foo = customAlloc<X>(); // expected-error {{variable of type 'X' is not valid on the heap}} expected-note {{value incorrectly allocated on the heap}}
  X *foo2 = new (100) X(); // expected-error {{variable of type 'X' is not valid on the heap}} expected-note {{value incorrectly allocated on the heap}}
}

Messung V0.5 in Prozent
C=91 H=98 G=94

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik