Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
D Cookbook

You're reading from   D Cookbook Discover the advantages of programming in D with over 100 incredibly effective recipes with this book and ebook.

Arrow left icon
Product type Paperback
Published in May 2014
Publisher
ISBN-13 9781783287215
Length 362 pages
Edition Edition
Arrow right icon
Author (1):
Arrow left icon
Adam Ruppe Adam Ruppe
Author Profile Icon Adam Ruppe
Adam Ruppe
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

D Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Core Tasks FREE CHAPTER Phobos – The Standard Library Ranges Integration Resource Management Wrapped Types Correctness Checking Reflection Code Generation Multitasking D for Kernel Coding Web and GUI Programming Addendum Index

Documenting your code with Ddoc


To verify your code is working correctly, you must know what it is supposed to do. Like with unit testing, D has a built-in documentation generator called Ddoc. Ddoc is fairly simple, but it gets the job done and is always available.

How to do it…

Perform the following steps to document your code:

  1. Attach documentation comments to declarations by writing /** Docs */ or /++ Docs +/ above them or /// short description directly after them.

  2. Put documentation comments on both collections and members. For example, if you document a class member, ensure that there's a doc comment on the class itself too.

  3. Document unit tests that you want to serve as usage examples.

  4. Document function parameters by writing lines in the format: name = meaning under a section Params:.

  5. Compile the module with the –D flag to dmd to generate the documentation's HTML file.

  6. You may define and use macros. They are defined in a special section named Macros: with a name=value syntax and used with $(name...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image