В самом начале создаем 1 элемент стека "top" (он же пока что и является верхним) при помощи конструктора с полями key = NULL, deeperElement = NULL;
В чистом репозитории только папка .git, как люди будут работать с ним?
Может есть какой-то стандарт, о котором я не знаю?
(1) Make separate commits for logically separate changes.
Unless your patch is really trivial, you should not be sending
out a patch that was generated between your working tree and
your commit head. Instead, always make a commit with complete
commit message and generate a series of patches from your
repository. It is a good discipline.
Give an explanation for the change(s) that is detailed enough so
that people can judge if it is good thing to do, without reading
the actual patch text to determine how well the code does what
the explanation promises to do.
If your description starts to get too long, that's a sign that you
probably need to split up your commit to finer grained pieces.
That being said, patches which plainly describe the things that
help reviewers check the patch, and future maintainers understand
the code, are the most beautiful patches. Descriptions that summarise
the point in the subject well, and describe the motivation for the
change, the approach taken by the change, and if relevant how this
differs substantially from the prior version, are all good things
to have.
Make sure that you have tests for the bug you are fixing. See
t/README for guidance.
When adding a new feature, make sure that you have new tests to show
the feature triggers the new behaviour when it should, and to show the
feature does not trigger when it shouldn't. Also make sure that the
test suite passes after your commit. Do not forget to update the
documentation to describe the updated behaviour.
Speaking of the documentation, it is currently a liberal mixture of US
and UK English norms for spelling and grammar, which is somewhat
unfortunate. A huge patch that touches the files all over the place
only to correct the inconsistency is not welcome, though. Potential
clashes with other changes that can result from such a patch are not
worth it. We prefer to gradually reconcile the inconsistencies in
favor of US English, with small and easily digestible patches, as a
side effect of doing some other real work in the vicinity (e.g.
rewriting a paragraph for clarity, while turning en_UK spelling to
en_US). Obvious typographical fixes are much more welcomed ("teh ->
"the"), preferably submitted as independent patches separate from
other documentation changes.
Oh, another thing. We are picky about whitespaces. Make sure your
changes do not trigger errors with the sample pre-commit hook shipped
in templates/hooks--pre-commit. To help ensure this does not happen,
run git diff --check on your changes before you commit.
(2) Describe your changes well.
The first line of the commit message should be a short description (50
characters is the soft limit, see DISCUSSION in git-commit(1)), and
should skip the full stop. It is also conventional in most cases to
prefix the first line with "area: " where the area is a filename or
identifier for the general area of the code being modified, e.g.
. archive: ustar header checksum is computed unsigned
. git-cherry-pick.txt: clarify the use of revision range notation
If in doubt which identifier to use, run "git log --no-merges" on the
files you are modifying to see the current conventions.
The body should provide a meaningful commit message, which:
. explains the problem the change tries to solve, iow, what is wrong
with the current code without the change.
. justifies the way the change solves the problem, iow, why the
result with the change is better.
. alternate solutions considered but discarded, if any.
Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
to do frotz", as if you are giving orders to the codebase to change
its behaviour. Try to make sure your explanation can be understood
without external resources. Instead of giving a URL to a mailing list
archive, summarize the relevant points of the discussion.
>>> lst = [1, 2, 3, 4, 5] * 10
>>>
>>> out = [n * 2 if i % 9 == 0 else n
... for i, n in enumerate(lst, 1)]
>>> out
[1, 2, 3, 4, 5, 1, 2, 3, 8, 5, 1, 2, 3, 4, 5, 1, 2, 6, 4, 5, 1, 2, 3, 4, 5, 1, 4, 3, 4, 5, 1, 2, 3, 4, 5, 2, 2, 3, 4, 5, 1, 2, 3, 4, 10, 1, 2, 3, 4, 5]
>>>
int main(int argc, char *argv[])
int main(int argc, char **argv)
void func(char ***p) { (*p)++; }
...
func(&argv);
#include <iostream>
using namespace std;
void func(char ***p)
{
(*p)++;
}
int main(int argc, char *argv[])
{
cout << argv << " " << *argv << endl;
func(&argv);
cout << argv << " " << ((*argv) ? *argv : "no") << endl;
return 0;
}
[guest@localhost cpp]$ .iso++ t.cpp -o t
[guest@localhost cpp]$ ./t
0xbffc3114 ./t
0xbffc3118 no
[guest@localhost cpp]$ ./t a
0xbf999594 ./t
0xbf999598 a
[guest@localhost cpp]$
но при запуске в строке сбора данных о процессоре происходит ошибка:
[guest@localhost ~]$ s="abc"def(g)"hij"
bash: syntax error near unexpected token `('
[guest@localhost ~]$
[guest@localhost ~]$ s="abc'def(g)'hij"
[guest@localhost ~]$
>>> import lxml.html
>>>
>>> s = b'<div>Hyv\xc3\xa4 juoni!</div>'.decode('utf-8')
>>>
>>> doc = lxml.html.fromstring(s)
>>> doc
<Element div at 0xb744be3c>
>>> doc.text
'Hyvä juoni!'
>>>
#include <stdio.h>
int *func(int a, int b, int *p)
{
p[0] = a;
p[1] = b;
return p;
}
int main(void)
{
int arr[4], *p;
p = func(1, 2, arr);
printf("%d %d\n", p[0], p[1]);
p = func(3, 4, arr + 2);
printf("%d %d\n", p[0], p[1]);
p = arr;
printf("%d %d %d %d\n", p[0], p[1], p[2], p[3]);
return 0;
}
[guest@localhost c]$ .ansi t.c -o t
[guest@localhost c]$ ./t
1 2
3 4
1 2 3 4
[guest@localhost c]$
>>> def f1(x):
... return 2 * x
...
>>> def f2(x):
... return x * x
...
>>> def g(func, start, end, step):
... while start <= end:
... yield start, func(start)
... start += step
...
>>> list(g(f1, -3, 3, 1))
[(-3, -6), (-2, -4), (-1, -2), (0, 0), (1, 2), (2, 4), (3, 6)]
>>>
>>> list(g(f2, 0, 10, 1))
[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25), (6, 36), (7, 49), (8, 64), (9, 81), (10, 100)]
>>>