Knowledge (XXG)

Talk:Delete (C++)

Source 📝

309: 249: 222: 191: 362: 341: 153: 416: 482:
instead of 0. The "edit summary" field was insufficient for explaining my justification for doing so and several previous edits changed NULL to 0 with the following vague and nebulous justifications:
593: 147: 79: 536:
indicates to a human reader that the variable is a pointer without needing to reference the declaration). This is driven home by the fact that C++11 defines
299: 603: 598: 323: 450: 449:
The last paragraph is too hairy, I don't want too touch it, but it should explain that using the wrong delete is a security vulnerability, linking to:
588: 583: 289: 623: 406: 85: 44: 633: 265: 382: 30: 618: 318: 232: 99: 561: 459: 256: 227: 104: 20: 369: 346: 74: 608: 202: 613: 168: 65: 135: 451:
http://replay.web.archive.org/20080703153358/http://taossa.com/index.php/2007/01/03/attacking-delete-and-delete-in-c
109: 129: 381:
topics on Knowledge (XXG). If you would like to participate, please visit the project page, where you can join
374: 208: 628: 190: 463: 455: 125: 532:
instead of 0 produces more self-documenting code (i.e., when manipulating a pointer value, setting it to
55: 565: 264:
on Knowledge (XXG). If you would like to participate, please visit the project page, where you can join
70: 557: 175: 487:"int *p_var = NULL" is still valid C++ syntax, but is very C-style, making it equal zero is more C++ 161: 51: 141: 24: 577: 548:). Also, if you're using the GCC C++ compiler (I don't know about other compilers) 308: 556:
which means the compiler will always understand the rvalue to be a pointer value (
248: 221: 521: 569: 467: 524:). However, this rational is purely a matter of personal preference and 478:
I recently made an edit to initialize pointers in the code snippets with
261: 361: 340: 520:
is, as Bjarne Stroustrup explains, to avoid macros whenever possible (
492:
Changed NULL to 0, although null is same as 0, it should be avoided.
558:
http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch04s03.html
427: 378: 184: 15: 307: 160: 540:(of course, if you're writing to the C++11 standard, 516:should be avoided. The only reason to avoid using 373:, a collaborative effort to improve the coverage of 260:, a collaborative effort to improve the coverage of 174: 594:Redirect-Class software articles of Low-importance 33:for general discussion of the article's subject. 500:is no less "C++ style" (whatever that is) than 201:does not require a rating on Knowledge (XXG)'s 496:Frankly, neither of these are good reasons. 8: 522:http://www.stroustrup.com/bs_faq2.html#null 335: 216: 445:using the wrong delete is a vulnerability 512:. And there is no indication as to why 426:This article falls within the scope of 337: 218: 367:This redirect is within the scope of 254:This redirect is within the scope of 188: 7: 528:is part of the C++ standard. Using 274:Knowledge (XXG):WikiProject Software 207:It is of interest to the following 23:for discussing improvements to the 14: 604:Low-importance Computing articles 599:Redirect-Class Computing articles 391:Knowledge (XXG):WikiProject C/C++ 50:New to Knowledge (XXG)? Welcome! 589:Low-importance software articles 584:Redirect-Class software articles 411:This redirect has been rated as 360: 339: 294:This redirect has been rated as 247: 220: 189: 45:Click here to start a new topic. 316:This redirect is supported by 1: 624:Mid-importance C/C++ articles 385:and see a list of open tasks. 277:Template:WikiProject Software 268:and see a list of open tasks. 42:Put new text under old text. 570:03:45, 26 October 2012 (UTC) 544:would be much preferred to 650: 634:WikiProject C/C++ articles 394:Template:WikiProject C/C++ 300:project's importance scale 425: 410: 355: 315: 293: 242: 215: 80:Be welcoming to newcomers 468:18:00, 14 May 2011 (UTC) 619:NA-Class C/C++ articles 609:All Computing articles 494: 489: 312: 75:avoid personal attacks 614:All Software articles 490: 485: 319:WikiProject Computing 311: 100:Neutral point of view 257:WikiProject Software 105:No original research 554:#define NULL __null 313: 203:content assessment 86:dispute resolution 47: 458:comment added by 442: 441: 438: 437: 434: 433: 370:WikiProject C/C++ 334: 333: 330: 329: 280:software articles 183: 182: 66:Assume good faith 43: 641: 555: 551: 547: 543: 539: 535: 531: 527: 519: 515: 511: 507: 503: 499: 481: 470: 417:importance scale 399: 398: 395: 392: 389: 364: 357: 356: 351: 343: 336: 282: 281: 278: 275: 272: 251: 244: 243: 238: 235: 224: 217: 194: 193: 185: 179: 178: 164: 95:Article policies 16: 649: 648: 644: 643: 642: 640: 639: 638: 574: 573: 553: 549: 545: 541: 537: 533: 529: 525: 517: 513: 509: 505: 501: 497: 479: 476: 453: 447: 396: 393: 390: 387: 386: 349: 279: 276: 273: 270: 269: 236: 230: 121: 116: 115: 114: 91: 61: 12: 11: 5: 647: 645: 637: 636: 631: 626: 621: 616: 611: 606: 601: 596: 591: 586: 576: 575: 475: 472: 446: 443: 440: 439: 436: 435: 432: 431: 424: 421: 420: 413:Mid-importance 409: 403: 402: 400: 397:C/C++ articles 383:the discussion 365: 353: 352: 350:Mid‑importance 344: 332: 331: 328: 327: 324:Low-importance 314: 304: 303: 296:Low-importance 292: 286: 285: 283: 266:the discussion 252: 240: 239: 237:Low‑importance 225: 213: 212: 206: 195: 181: 180: 118: 117: 113: 112: 107: 102: 93: 92: 90: 89: 82: 77: 68: 62: 60: 59: 48: 39: 38: 35: 34: 28: 13: 10: 9: 6: 4: 3: 2: 646: 635: 632: 630: 627: 625: 622: 620: 617: 615: 612: 610: 607: 605: 602: 600: 597: 595: 592: 590: 587: 585: 582: 581: 579: 572: 571: 567: 563: 559: 523: 508:operator, or 493: 488: 484: 473: 471: 469: 465: 461: 457: 452: 444: 429: 423: 422: 418: 414: 408: 405: 404: 401: 384: 380: 376: 372: 371: 366: 363: 359: 358: 354: 348: 345: 342: 338: 325: 322:(assessed as 321: 320: 310: 306: 305: 301: 297: 291: 288: 287: 284: 267: 263: 259: 258: 253: 250: 246: 245: 241: 234: 229: 226: 223: 219: 214: 210: 204: 200: 196: 192: 187: 186: 177: 173: 170: 167: 163: 159: 155: 152: 149: 146: 143: 140: 137: 134: 131: 127: 124: 123:Find sources: 120: 119: 111: 110:Verifiability 108: 106: 103: 101: 98: 97: 96: 87: 83: 81: 78: 76: 72: 69: 67: 64: 63: 57: 53: 52:Learn to edit 49: 46: 41: 40: 37: 36: 32: 26: 22: 18: 17: 629:C++ articles 495: 491: 486: 477: 448: 412: 368: 317: 295: 255: 209:WikiProjects 198: 171: 165: 157: 150: 144: 138: 132: 122: 94: 25:Delete (C++) 19:This is the 562:71.65.94.23 460:99.224.97.6 454:—Preceding 148:free images 31:not a forum 578:Categories 474:NULL vs. 0 233:Computing 88:if needed 71:Be polite 27:redirect. 21:talk page 456:unsigned 271:Software 262:software 228:Software 199:redirect 56:get help 29:This is 542:nullptr 538:nullptr 415:on the 298:on the 154:WP refs 142:scholar 504:, the 205:scale. 126:Google 388:C/C++ 347:C/C++ 197:This 169:JSTOR 130:books 84:Seek 566:talk 560:). 550:NULL 546:NULL 534:NULL 530:NULL 526:NULL 518:NULL 514:NULL 498:NULL 480:NULL 464:talk 377:and 162:FENS 136:news 73:and 552:is 510:for 502:int 428:C++ 407:Mid 379:C++ 290:Low 176:TWL 580:: 568:) 506:++ 466:) 326:). 231:: 156:) 54:; 564:( 462:( 430:. 419:. 375:C 302:. 211:: 172:· 166:· 158:· 151:· 145:· 139:· 133:· 128:( 58:.

Index

talk page
Delete (C++)
not a forum
Click here to start a new topic.
Learn to edit
get help
Assume good faith
Be polite
avoid personal attacks
Be welcoming to newcomers
dispute resolution
Neutral point of view
No original research
Verifiability
Google
books
news
scholar
free images
WP refs
FENS
JSTOR
TWL

content assessment
WikiProjects
WikiProject icon
Software
Computing
WikiProject icon

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.