(FREE PDF Sample) Professional C++ Gregoire Ebooks
(FREE PDF Sample) Professional C++ Gregoire Ebooks
com
https://textbookfull.com/product/professional-c-
gregoire/
https://textbookfull.com/product/primary-mathematics-
textbook-2b-jennifer-hoerst/
textbookfull.com
https://textbookfull.com/product/professional-c-4th-edition-marc-
gregoire/
textbookfull.com
https://textbookfull.com/product/professional-c-5th-edition-marc-
gregoire/
textbookfull.com
https://textbookfull.com/product/indexes-a-chapter-from-the-chicago-
manual-of-style-17-17th-edition-coll/
textbookfull.com
https://textbookfull.com/product/architectured-materials-in-nature-
and-engineering-archimats-yuri-estrin/
textbookfull.com
https://textbookfull.com/product/beaglebone-home-automation-
blueprints-1st-edition-rodolfo-giometti/
textbookfull.com
https://textbookfull.com/product/management-of-banking-and-financial-
services-4th-edition-padmalatha-suresh-justin-paul/
textbookfull.com
Computer and Information Sciences 31st International
Symposium ISCIS 2016 Kraków Poland October 27 28 2016
Proceedings 1st Edition Tadeusz Czachórski
https://textbookfull.com/product/computer-and-information-
sciences-31st-international-symposium-iscis-2016-krakow-poland-
october-27-28-2016-proceedings-1st-edition-tadeusz-czachorski/
textbookfull.com
PROFESSIONAL
C++
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xlvii
Continues
▸▸ PART IV MASTERING ADVANCED FEATURES OF C++
CHAPTER 21 Customizing and Extending the Standard Library. . . . . . . . . . . . . . 727
CHAPTER 22 Advanced Templates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
CHAPTER 23 Multithreaded Programming with C++. . . . . . . . . . . . . . . . . . . . . . . 813
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087
PROFESSIONAL
C++
PROFESSIONAL
C++
Fourth Edition
Marc Gregoire
Professional C++, Fourth Edition
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2018 by John Wiley & Sons, Inc., Indianapolis, Indiana
ISBN: 978-1-119-42130-6
ISBN: 978-1-119-42126-9 (ebk)
ISBN: 978-1-119-42122-1 (ebk)
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-
6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or pro-
motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold
with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services.
If professional assistance is required, the services of a competent professional person should be sought. Neither the pub-
lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to
in this work as a citation and/or a potential source of further information does not mean that the author or the publisher
endorses the information the organization or Web site may provide or recommendations it may make. Further, readers
should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was
written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with stan-
dard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such
as a CD or DVD that is not included in the version you purchased, you may download this material at http://
booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2017963243
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trade-
marks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries,
and may not be used without written permission. All other trademarks are the property of their respective owners. John
Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
Dedicated to my parents and my brother, who are
always there for me. Their support and patience
helped me in finishing this book.
ABOUT THE AUTHOR
MARC GREGOIRE is a software architect from Belgium. He graduated from the University of Leuven,
Belgium, with a degree in “Burgerlijk ingenieur in de computer wetenschappen” (equivalent to mas-
ter of science in engineering: computer science). The year after, he received an advanced master’s
degree in artificial intelligence, cum laude, at the same university. After his studies, Marc started
working for a software consultancy company called Ordina Belgium. As a consultant, he worked for
Siemens and Nokia Siemens Networks on critical 2G and 3G software running on Solaris for tele-
com operators. This required working with international teams stretching from South America and
the United States to Europe, the Middle East, Africa, and Asia. Now, Marc is a software architect at
Nikon Metrology (www.nikonmetrology.com), a division of Nikon and a leading provider of preci-
sion optical instruments and metrology solutions for 3D geometric inspection.
His main expertise is in C/C++, and specifically Microsoft VC++ and the MFC framework. He has
experience in developing C++ programs running 24/7 on Windows and Linux platforms: for exam-
ple, KNX/EIB home automation software. In addition to C/C++, Marc also likes C# and uses PHP
for creating web pages.
Since April 2007, he has received the annual Microsoft MVP (Most Valuable Professional) award
for his Visual C++ expertise.
Marc is the founder of the Belgian C++ Users Group (www.becpp.org), co-author of C++ Standard
Library Quick Reference (Apress), technical editor for numerous books for several publishers, and
a member on the CodeGuru forum (as Marc G). He maintains a blog at www.nuonsoft.com/blog/,
and is passionate about traveling and gastronomic restaurants.
ABOUT THE TECHNICAL EDITOR
PETER VAN WEERT is a Belgian software engineer, whose main interests and expertise are in C++,
programming languages, algorithms, and data structures.
He received his master of science in computer science from the University of Leuven, Belgium,
summa cum laude, with congratulations of the Board of Examiners. In 2010, the same university
awarded him a PhD for his research on the efficient compilation of rule-based programming lan-
guages (mainly Java). During his doctoral studies, he was a teaching assistant for courses on object-
oriented analysis and design, Java programming, and declarative programming languages.
After his studies, Peter worked for Nikon Metrology on large-scale, industrial-application software
in the area of 3D laser scanning and point cloud inspection. In 2017, he joined the software R&D
unit of Nobel Biocare, which specializes in digital dentistry software. Throughout his professional
career, Peter has mastered C++ software development, as well as the management, refactoring, and
debugging of very large code bases. He also gained further proficiency in all aspects of the software
development process, including the analysis of functional and technical requirements, and Agile-
and Scrum-based project and team management.
Peter is a regular speaker at, and board member of, the Belgian C++ Users Group. He also co-
authored two books: C++ Standard Library Quick Reference and Beginning C++ (5th edition), both
published by Apress.
CREDITS
MARKETING MANAGER
Christie Hilbrich
ACKNOWLEDGMENTS
I THANK THE JOHN WILEY & SONS AND WROX Press editorial and production teams for their sup-
port. Especially, thank you to Jim Minatel, executive editor at Wiley, for giving me a chance to
write this new edition, Adaobi Obi Tulton, project editor, for managing this project, and Marylouise
Wiack, copy editor, for improving readability and consistency and making sure the text is gram-
matically correct.
A very special thank you to my technical editor, Peter Van Weert, for his outstanding technical
review. His many constructive comments and ideas have certainly made this book better.
Of course, the support and patience of my parents and my brother were very important in finishing
this book. I would also like to express my sincere gratitude toward my employer, Nikon Metrology,
for supporting me during this project.
Finally, I thank you, the reader, for trying this approach to professional C++ software development.
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
CONTENTS
INTRODUCTION xlvii
xviii
CONTENTS
Dynamic Strings 58
C-Style Strings 58
String Literals 60
Raw String Literals 60
The C++ std::string Class 62
What Is Wrong with C-Style Strings? 62
Using the string Class 62
std::string Literals 64
High-Level Numeric Conversions 64
Low-Level Numeric Conversions 65
The std::string_view Class 67
std::string_view Literals 69
Nonstandard Strings 69
Summary 69
xix
CONTENTS
Hungarian Notation 85
Getters and Setters 86
Capitalization 86
Namespaced Constants 86
Using Language Features with Style 86
Use Constants 87
Use References Instead of Pointers 87
Use Custom Exceptions 88
Formatting 88
The Curly Brace Alignment Debate 88
Coming to Blows over Spaces and Parentheses 89
Spaces and Tabs 90
Stylistic Challenges 90
Summary 91
xx
CONTENTS
xxi
CONTENTS
Abstraction 138
Interface versus Implementation 138
Deciding on an Exposed Interface 139
Consider the Audience 139
Consider the Purpose 139
Consider the Future 141
Designing a Successful Abstraction 141
Summary 142
xxii
CONTENTS
xxiii
CONTENTS
Friends 232
Dynamic Memory Allocation in Objects 233
The Spreadsheet Class 233
Freeing Memory with Destructors 235
Handling Copying and Assignment 236
The Spreadsheet Copy Constructor 239
The Spreadsheet Assignment Operator 240
Disallowing Assignment and Pass-By-Value 242
Handling Moving with Move Semantics 243
Rvalue References 243
Implementing Move Semantics 245
xxiv
CONTENTS
xxv
CONTENTS
xxvi
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
CONTENTS
References 334
Reference Variables 334
Modifying References 335
References to Pointers and Pointers to References 336
Reference Data Members 336
Reference Parameters 336
References from Pointers 337
Pass-by-Reference versus Pass-by-Value 337
Reference Return Values 338
Rvalue References 338
Deciding between References and Pointers 339
Keyword Confusion 343
The const Keyword 343
const Variables and Parameters 343
const Methods 345
The constexpr Keyword 346
The static Keyword 347
static Data Members and Methods 347
static Linkage 347
static Variables in Functions 350
Order of Initialization of Nonlocal Variables 351
Order of Destruction of Nonlocal Variables 351
Types and Casts 351
Type Aliases 352
Type Aliases for Function Pointers 353
Type Aliases for Pointers to Methods and Data Members 355
typedefs 356
xxvii
CONTENTS
Casts 357
const_cast() 357
static_cast() 358
reinterpret_cast() 359
dynamic_cast() 360
Summary of Casts 361
Scope Resolution 362
Attributes 363
[[noreturn]] 363
[[deprecated]] 364
[[fallthrough]] 364
[[nodiscard]] 364
[[maybe_unused]] 365
Vendor-Specific Attributes 365
User-Defined Literals 365
Standard User-Defined Literals 367
Header Files 367
C Utilities 369
Variable-Length Argument Lists 369
Accessing the Arguments 370
Why You Shouldn’t Use C-Style Variable-Length Argument Lists 371
Preprocessor Macros 371
Summary 372
xxviii
CONTENTS
xxix
CONTENTS
xxx
CONTENTS
xxxi
Random documents with unrelated
content Scribd suggests to you:
given to their play by one taking the head of the other between his
fore-flippers, as if about to salute him, or more likely her, in the
orthodox fashion. One was seen the other morning in possession of
a large fish, while a number of gulls sat at a safe distance round
him, waiting for the fragments when the feast should begin. By the
way he glared at them, he was evidently annoyed at their presence.
Sinking for a few seconds, he appeared on the surface minus the
fish. This was evidently intended as a ruse, and meant to imply that
he had lost it; but the gulls seemed to know better, and kept their
position. Diving, he made his appearance some distance off, this
time with the fish in his mouth, only to find himself, to his
annoyance, again the centre of wistful expectations. Presuming
these gulls to be up-to-date birds, their exulting cacklings might be
literally rendered—“You better begin, Mister Phoca; it’s no use trying,
you know; you can’t possibly dewett us!” At least, the seal seemed
to think so, for he there and then opened the banquet with a rip of
his teeth that distributed the offal amongst the hungry cordon.
The rocks become at this season of the year invested with a
slippery coating of algæ, which renders it extremely difficult to
maintain one’s footing, and also necessitates repeated applications
of hot lime to our gratings in order to render them passable. Myriads
of minute whelks, no larger than turnip seed, strew the rocks and
crunch under foot as we walk, while great patches of mussel spawn
delight the heart of the more venturesome of the white whelks—a
prospecting party who will doubtless communicate the promising
state of the commissariat to their fellows still in winter quarters.
Fishing in the Rock pools has been tried for the first time this
season, and resulted in the capture of a solitary “cobbler.” It may be
a month hence before we meet with any success.
This month has been extremely mild, though the hills behind
Arbroath are still seen to carry portions of their winter coat, while
the higher ranges inland are completely snow-capped. On a clear
day our view is limited by Tod Head, about twenty-five miles to the
north, and St Abb’s Head thirty miles south of us. The coast-line
presents a uniform flatness, which becomes monotonous in
comparison with the more picturesque raggedness of the West
Coast. A most conspicuous feature in the landscape in the vicinity of
Arbroath is the clump of trees on the summit of the Law Hill—a
landmark well known to navigators, and easily discernible, as it
stands sharply defined against the sky-line. Arbroath, when not
enveloped in smoke, is clearly seen, and with the aid of our
telescope the after-church promenaders can be distinguished on the
Protection Wall, or wending their way towards the Victoria Park.
APRIL 1902.
Only towards the end of this month did we experience anything like
summer weather. Belieing the wintry weather we had been
experiencing, the fragrant odour of the hawthorn blossom borne on
the off-shore wind imparts a pleasurable sensation, recalling scenes
of earlier days when void of care we went “flourish” gathering, or
later on disported ourselves amongst the “hips and haws.” Here, no
sylvan scenery greets the tired eye nor gives respite to the senses
from the everlasting waste of waters, with its ever-changing moods,
from placid glassy calm to the wildest turbulence, when blustering
Boreas drives his team amain, and the white-maned coursers charge
down upon us like an avalanche. As the tide drops, and the long lush
tangles trail their tattered tops on the surface, a dank heavy odour is
perceptible, scarcely so pleasing to the senses as that of the
“hawthorn bud that opes in the month of May.” Equipped with a
stout stick bearing an iron hook, an hour’s crab-hunting among the
rocks brings one into contact with many forms of life otherwise
unnoticed. Groping underneath a projecting ledge, to ascertain if the
inmate is at home, the eye is arrested by minute nodules of scarlet
jelly pendant from the roof, and destined to become a close imitation
of their terrestrial namesake the anemone, or, in similar situations,
patches of white whelk ova appear like so many grains of wheat
arranged as close as possible to each other.
Recently a solitary instance was noticed of a whelk carrying the
ova attached to the exterior of its own shell. Many different species
of whelks are thus met with, some scarcely distinguishable by the
naked eye. The intrusion of the crab-stick soon betrays the presence
of the crab. Gripping the “cleek” in his claws, he prepares for
resistance by forcing his back against the roof of his domicile with all
the power his crooked legs are capable of. Should he feel himself
being drawn he immediately releases his grip, and, if possible,
“seeks his benmost bore.” Should the cleek find a favourable hold,
such as under the armpit, so to speak, he is soon dislodged, but if
the hole be somewhat crooked it is extremely difficult to move him,
and even then he may make his appearance in sections, as he parts
company with the different members of his body on the slightest
provocation, a proceeding about which he has but little
compunction, as he knows well others will soon sprout in their
places, a convenience which Nature might with advantage have
extended to the genus homo. Poachers, it is stated, have made use
of these crustaceans while “ferretting” rabbits, by sending them into
the burrows with a stump of lighted candle stuck on their backs. One
can fancy the surprise with which “bunny” would stand aghast at
such a fearful apparition.
Scarcely a bird is to be seen in our vicinity at present, nesting
operations calling them elsewhere. A few foraging gannets are seen
daily passing and repassing, catering for their sitting mates on the
Bass Rock. The terns and gulls will probably have their wants
supplied from the shores in the neighbourhood of their nurseries.
The nest of the tern is of the simplest description—a slight
depression on a gravelly beach or grassy mound, or even the bare
surface of a rock is considered sufficient for their purpose, nest-
building, in their estimation, being evidently considered superfluous.
It is surprising that the eggs remain in some of the positions in
which they are deposited. I have frequently set them rolling along
the rock surface by the action of my breath. On their exit from the
egg the young are immediately led by the parents to a shingly
beach, or other place of concealment, where it is extremely difficult
to detect them from their surroundings. Here they are fed with sand-
eels and other small fry till such time as they are able to wing their
way to the fishing grounds themselves, though even then they are
frequently the recipients of the parents’ generosity, their hunting
powers being as yet inadequate to supply their needs.
The work in connection with the alterations here progresses
rapidly, and by the end of next month it is expected but little will be
left undone. To all external appearance the work is already finished,
but the building of the huge lens and revolving machinery, along
with the internal fittings, have yet to be completed.
JULY 1902.
The coating of acorn barnacles with which the higher surfaces of the
Rock and also the base of the tower are whitened in summer is fast
disappearing before the ravages of that ruthless destroyer the white
whelk. Seen from the balcony, this encrustation resembles a lime-
hauled wall, and presents a suitable background for the observation
of moving objects under water. These barnacles are frequently
mistaken by the casual observer for young limpets, whereas, unlike
the limpet, which moves freely from place to place in quest of
vegetable diet, the moment the young barnacle settles to erect his
limey habitation, he possesses a fixity of tenure which terminates
only with his existence. An outer wall, with razor edges, surrounds a
hollow cone, his private apartment, and probably guards his four-
leaved door from injury. This opening, through which all business
with the outer world is transacted, is scarcely discernible when
above water; but immediately the tide covers it, the hollow cone is
seen to fall apart in four vertical sections, a bunch of fingers is thrust
forth and rhythmic clutches made at invisible food. How little they
resemble their relatives who swing by their pendulous stalks from
ships’ bottoms or submerged wreckage, and see the world without
any exertion of their own. The ancients firmly believed that from
these animals certain birds were produced, probably from the
resemblance of their shelly casement to the beak of a bird, and the
bird known as the barnacle-goose owes his name to this belief. Even
to-day there are persons who solemnly declare that the Northern
Diver is so evolved.
Another fallacy common amongst fishing communities on the
West Coast is the attributing the destructive effects of the teredo
navalis, or ship-worm, to the innocent barnacle, whose only fault is
the resistance their multitudes offer to a ship’s progress through the
water. A log of wood which has been adrift at sea for a lengthened
period will generally be found to have its surface clustered with
pendulous barnacles. The removal of these disclose minute pin-holes
on the surface, which, in the interior, assume the diameter of a
man’s little finger, and permeate the log from end to end like a
honeycomb. Each little tunnel is smoothly enamelled with a deposit
of lime by this indefatigable borer, the teredo. Though boring parallel
with his neighbour, the thickness of paper only separating them,
they never, by any chance, encroach on each other’s bore. Their
tracks are seen to abruptly diverge when all but into that of their
neighbour, so that they are evidently cognisant of each other’s
proximity, an interesting fact also apparent in rats on board wooden
vessels, who, though they will gnaw their way through any
woodwork, instinctively refrain from suicidal attempts on the outer
skin of the ship.
On the memorable 9th we had a bird’s-eye view of the Coronation
celebrations in Arbroath. With the aid of our telescope the crowds on
the Common were clearly visible, the ladies in white dresses being
most conspicuous. The flash of the guns firing the royal salute was
seen fifty-five seconds before the report reached us. In the
afternoon the sports in the Victoria Park occupied our attention, and
the white-clad competitors in the high jump could be seen taking
their preliminary run and rising over the obstacle. Parties straying on
the beach had only their heads visible, and as they neared the
margin appeared to vanish under water. The progress of the bonfire
on the Common at night was also watched, and the moving figures
could be plainly seen silhouetted in the glare. Probably but few
noticed our attempt to celebrate the occasion. Two strings of flags
from the balcony to the rocks fluttered gaily in the breeze, while the
balcony railing was similarly decked. Amongst those suspended from
the rail was a flag of peculiar interest, namely, one which had been
sewn by Miss Stevenson, a sister of the builder, Robert Stevenson,
almost a hundred years ago. The central subject depicted on the
white ground is the Bell Rock Lighthouse; on the right, the patron
saint of Scotland with his cross; while a ship under full sail occupies
the left, the whole bordered with a deep edging of red. The figures
are extremely well executed, and the colouring to the flesh tints
remarkable. The flag was presented to the Rock by Miss Stevenson
to be used as a table draping during divine service.
Several white butterflies and moths innumerable were seen
passing here this month. It seems these insects have their migratory
periods as well as birds, and at stations favourable for their
observation they appeared, to quote from a writer in a recent
number of “Chambers’s,” “as a dense snowstorm driven by a light
breeze, and this not for one day only, but for many in succession.
Whereas birds come and go with clockwork regularity, the
immigration of butterflies is uncertain, and of all those which survive
the perils of the deep no single one returns.”
SEPTEMBER 1902.
A good deal of heavy weather has been experienced on the Rock this
month, and the stability of our new lantern subjected to a fair strain,
though probably nothing to what it will have to encounter during the
course of the winter. The lantern—composed of gun metal astragals,
narrowed to the utmost limit compatible with strength, in order to
intercept as little light as possible—may be looked upon as a huge
hollow cylinder of glass, which in itself seems but a feeble barrier to
the onslaughts of the storm. But the three tiers of triangular panes
are of heavy plate glass, and the apparently slim like astragals are
braced together in the most effective manner to ensure the greatest
degree of strength, and need cause no uneasiness to the stranger
viewing the outlook during the progress of a gale. It is awful to think
that out in that dark void, amid the warring elements, fellow beings
may be battling for their lives in close proximity to where we sit in
comfort and security, totally ignorant of their condition, and utterly
helpless to render them the slightest assistance. Probably a case in
point occurred during the gale of the 3rd. On the 9th, about noon,
we were somewhat surprised to see the gunboat Seamew
approaching the Rock with a hoist of flags, indicating that they
wished to communicate with us. Bringing up close to the Rock, they
signalled, “Have you seen a vessel in distress?” to which we
answered “No”; and then remembering we had seen a torpedo boat
pass the day previous, and fearing another case of “buckling” had
occurred, we asked “Was it a torpedo boat?” in reply to which they
communicated the intelligence, “No; it is a sailing craft from
Anstruther last Wednesday, and seven hands.” On our replying “We
have not seen her,” the signal “Thank you” was hoisted, and the
gunboat steamed out to the eastward on her sorrowful quest.
Passing a torpedo boat at gun practice, she was seen to signal her
also, with the difference that the flags then used had no existence in
our code. Later in the evening she was again seen making for
Dundee.
We have had several takes of fish of late, though there seems to
be a scarcity of “fry” compared with last year, the absence of which
probably accounts for the terns failing to call upon us with their
young for a few weeks’ feasting prior to commencing their migratory
journey southwards. Gannets may be seen at present striking at fish
within a few feet of our doorway, while a flock of young gulls hover
expectantly, with feeble peeping cries anticipating the feast in store
for them when the dinner scraps make their appearance. Further off
a few eider ducks—who only arrived on the 25th, somewhat later
than last year—evidently eye the proceedings of these juvenile
degenerates with disdain, preferring to refrain from such pampered
luxuries and dine on the products of the chase alone. The eiders
present are as yet all adult males, the females presumably still
occupied with family cares teaching the young idea how to shoot, or
rather fish, if plucking mussels, catching crabs, etc., can be called so,
for such is their diet, and does not include fish. Strange that the
foremost arrivals among migratory birds are all males. Why this is so
is not agreed upon by observers, some supposing that the females
are detained by maternal duties; others, again, affirm that they
migrate en masse, and that the more vigorous males soon outstrip
and ungallantly leave the gentler sex to bring up the rear. On the 6th
we had our first intimation of the autumnal migratory flight in the
arrival of a flock of wheatears, accompanied by a solitary wren. On
the 27th several greenfinches, larks, and starlings were making
insane efforts to follow the line of most resistance, resulting in our
new lantern receiving its first baptism of blood, as the glass next
morning testified. Several porpoises are to be seen puffing and
blowing a mile off, and on the 28th a school of “finner” whales were
seen heading north.
I see by the Arbroath Guide that one of our old fog bells has been
presented by our Commissioners to the Arbroath Museum, a fit
resting place after its long sojourn on the Rock. Should the date
upon it happen by any chance to become erased, what possible
controversies it may yet become the subject of amongst posterity as
to its connection with that mythical personage “Ralph the Rover.” I
myself can testify to its having conformed in one respect at least
with that of the poem, for on lowering it from its position on the
balcony for shipment the tide had overflowed the Rock about a
couple of feet, causing the bell to settle with an audible gurgle, or as
one of the seamen (Fraser) appropriately quoted, “The bell sank
down with a gurgling sound.”
OCTOBER 1902.
The broken stones and other debris, consequent upon the late
alterations here, which had collected in various holes in the Rock and
maintained their position up till now, have nearly all been cleared
out by the severe gales of this month, and a couple of heavy iron
poles, erected lately to mark the boat tracks or entrances to the
landings, and which were sunk two feet in the solid rock and heavily
cemented, have been shaken loose in their sockets by the pounding
seas which have been besieging us of late. The rocks appear bleak
and bare, and utterly void of vegetation. The white whelks have
collected their scattered forces, and gone into winter quarters.
Secure in sheltering nooks, they lie huddled together in close packed
squadrons. Numerous small white banded whelks adhere to the base
of the tower with a tenacity that seems surprising considering the
swirling seas they are subjected to. This species, however, never
seem to dream of hibernating. The eiders and longtails, with an
unswerving attention to business, pursue their calling amid the
hurly-burly of broken, tumbling seas—evidently little concerned
whether the weather be fair or foul—and in the glassy hollows
alternating between the breakers they can be distinctly seen
scurrying over the rock surface like so many fish. Gannets this
month are conspicuous by their absence, and only a few parasitic
gulls divide their attention between the kitchen refuse and the hard
won earnings of the eiders.
On several occasions during the month our fog signal was
brought into action through the occurrence of heavy snowfalls. A
silent, feathery fall on shore no doubt has charms peculiarly its own,
but at sea constitutes a very serious danger to the anxious mariner
as he steams at reduced speed through the fleecy curtain, shrieking
his every two minute warning, his vessel’s head scarcely visible from
the bridge. In snowstorms such as we have had of late our lantern
soon becomes plastered up with snow on the weather side,
necessitating constant removal to prevent it from completely blinding
our light in that direction. This is an operation often accomplished
with difficulty, especially when carried out in the teeth of a gale—an
experience somewhat akin to lying out on a yardarm under similar
conditions, only one doesn’t have the lift and ’scend of the vessel to
contend with; yet his grip must be equally as sure, or, as the old
salts phrase it, “Every finger a fish-hook,” on such occasions.
Mounting by an outside ladder to the grated gallery which encircles
the base of the lantern, one is exposed to the full force of the blast,
and a firm grip must be taken to avoid being blown away. Below, the
seas in wild tumult break against the building with a deafening roar,
sending a perceptible tremor through the entire structure with each
impact. Only by energetically hauling on the hand-rail can the
slightest progress be made in the desired direction, the wind’s eye
being the objective point, where possibly on arrival one may find
himself pinned flat to the lantern, like an entomological specimen, by
the force of the wind. The snow removed, the return journey is
effected by simply allowing oneself to be blown gradually back.
While relieving the Bass Rock on our way ashore last relief, a
good opportunity was afforded of witnessing the mode of effecting a
landing under adverse circumstances. On arrival there, it was
considered dangerous to attempt a landing at either of the two
landing places, owing to the heavy sea then running. The landings—
a flight of concrete steps from the water edge to the rocks above—
are situated on either side of a slight promontory immediately
beneath the lighthouse; and as deep water obtains to the rock face,
it will be obvious that similar conditions must frequently prevail at
either landing. The boat being loaded with the necessary stores, and
the relieving keeper on board, an approach was made to within
suitable distance of the Rock. A kedge anchor was then thrown
overboard, and the boat slacked down till within working distance.
The keepers meanwhile had been busy erecting an iron pole or
derrick on the rocks above the position now occupied by the boat,
and which, being slightly inclined seawards, a tackle from its
extremity was drawn by means of a guy-line to the boat, and the
stores hoisted ashore by the keepers in charge of the tackle-fall
above. Seated in a loop of the rope, the relieving keeper was then
hoisted, and his shore-going neighbour similarly lowered. As an
extra precaution, a second boat was sent from the ship to stand by
the working boat in case of accident. Fortunately, however, their
services were not required.
Our final relief here for the year was effected with some difficulty
on the 29th. Owing to the doubtful aspect of the landing, only one
boat was sent ashore instead of two as usual. The fortnightly supply
of coal and water being omitted on this occasion does not, however,
inconvenience us, as a three months’ reserve stock of necessaries is
always maintained during the winter months.
JANUARY-FEBRUARY 1903.
Bright, sunny weather characterised the opening day of the year, the
sea assuming a suspicious placidity quite summer-like in appearance
but for the keen nip in the air perceptible out of doors. This state of
affairs, however, proved but ephemeral, and for the remainder of the
month we have experienced most boisterous weather. Strong
westerly winds occasionally attained the force of a gale,
accompanied with driving seas, which roared and sang a lullaby
scarcely compatible with the shore-dwellers’ sense of security, but
which, strange to say, has a more somnolent effect upon us than a
breathless stillness, though an occasional thumper of a sea, more
forceful than its fellows, demonstrates the stability of our domicile by
imparting a gentle tremor to the entire structure, awakening in the
sleeper a glimmer of consciousness and a hazy impression of a
traction-engine lumbering somewhere in the vicinity.
Our entrance doorway—thirty feet from the Rock—faces south-
west, and is guarded by a heavy double leaved door, which opens
outwards, and held open against the building by means of heavy
brass thumb-snecks. An inner or vestibule door of solid brass is
placed six feet further inwards—the walls here, by the way, being
seven feet thick, tapering to one foot immediately beneath the
balcony, sixty feet higher up. This door is also double-leaved, with
the upper panels of heavy plate glass, frequently obscured by the
strong westerly wind whipping the tops of the seas as they rise in
front, and carrying them souse into the doorway. Standing here
during the prevalence of a gale, the outlook is being constantly
darkened by a curtain of hissing foam drawn across the doorway, as
each sea breaks against the base of the tower, flinging the spray
high overhead. Fifteen miles in front of us lies the Isle of May, with
its castle-like lighthouse crowning its summit, while on a lower level
stands a whitewashed relic—remnant of a time, not so long ago,
when the Island boasted a double light, and electricity had not as
yet usurped sole sway. Emerging from the right of the May appears
the bluff outline of the Bass Rock, while away in the far distance
North Berwick Law cleaves the sky-line. Away to St Abb’s Head, on
the left, the Haddington coast stretches hazy and indistinct, while
the green, grassy slopes of Fife, with the spires of St Andrews faintly
visible, fill in the right of the picture. Laying hold of the man-ropes
suspended in the doorway, and turning to the right, the Forfarshire
coast is seen extending from the Tay in a long unbroken line, with
the snow-clad Grampians towering majestically in the background.
Right in front of us are the smoking stalks of Arbroath. Two
conspicuous white dots in the foreground mark the pierheads, in
front of which an impatient “flaxer” cruises in glorious uncertainty of
ever being permitted to fulfil her charter and deposit her Riga-run
freight on the right side of the bar. This is the panorama from the
viewpoint of our doorway on a clear day, but, as seen of late
through sheets of flying foam, it reminds one of a cinematograph
display, in which the films are far from perfect.
On the first Sunday of the year hundreds of gulls were seen
resting on the surface of the sea, half a mile nor’-west from here,
evidently by their movements enjoying a feast of “fry,” and in all
probability proclaiming the presence of herring shoals. During the
gale of 10th January over a dozen gannets were seen swooping and
diving, presumably at herring. Only with difficulty could we maintain
our position on the balcony, owing to the force of the wind, yet
these birds circled and dived amid the turmoil of wind and water
with a graceful ease and precision that seemed truly wonderful
considering the force of wind they occasionally beat up against, or,
as they turned broadside on, were wafted without the least exertion
in the opposite direction. The first week of February saw hundreds of
these birds back to their breeding haunts on the Bass Rock. From
the deck of the “Relief” steamer lying within a few hundred yards
their movements are clearly seen. Each projecting ledge of the
precipitous cliffs is tenanted by some members of the cackling