An operator in the C++ programming language. The object referenced by the pointer passed as an operand to delete is destroyed and the memory it used is freed.

To erase, obliterate, or remove. To cause something to enter a state of nonexistence. Often used of data.

Also a key on the PC keyboard which usually deletes the character to the right of the cursor.

On the Macintosh keyboard, the key marked "delete" is what a PC user would call a backspace key, and is in the position for such; the key marked "del" is a PC-style delete key.

DELETE is an SQL command for deleting data from a table in a (relational) database. Here is an example:

DELETE FROM example WHERE nickname='hax0r'

The statement above tells the database to delete all rows where the field nickname has the value 'hax0r' (a string) in the table called example.

The WHERE clause is the same as the one used by SELECT and UPDATE. If the WHERE clause is omitted, then all rows in the table will be deleted.

Here are some things that can cause the delete to fail:

  • Another table references the data in the table through a foreign key, and the foreign key does not cascade deletes. The delete only fails if there are rows in the referencing table with the same key values as the row(s) being deleted.
  • The user does not have permission to delete data from the table.
(Perl:)

delete $hash{ELEM} deletes the key named ELEM from the hash %hash. After this command, exists $hash{ELEM} will no longer be true. See exists for more information on the difference between the operators delete and undef when applied to a hash element (you usually want the former).

In fact, delete will accept a hash slice. So delete @hash{'a','b','c'} will delete the three keys 'a', 'b', 'c' from %hash.

The return value of this operator is the list of the values which were associated with the specified keys (prior to their deletion, of course). This return value is rarely used.

(C++:)

delete p, where p is some pointer, destroys the object that p points to and releases the memory which was allocated to it (using new). In particular, the object must have previously been allocated using new (and delete must not already have been called for this object).

Common errors using this operator include calling delete on an array (you should use delete[] instead), and using delete to free PODs allocated using malloc.

De*lete" (?), v. t. [imp. & p. p. Deleted; p. pr. & vb. n. Deleting.] [L. deletus, p. p. of delere to destroy. Cf. 1st Dele.]

To blot out; to erase; to expunge; to dele; to omit.

I have, therefore, . . . inserted eleven stanzas which do not appear in Sir Walter Scott's version, and have deleted eight. Aytoun.

 

© Webster 1913.

Log in or register to write something here or to contact authors.