# Stuff

index1: #c
index2: byte
edited_by: dho!~dho@veep.9vx.org
last_referenced_in: nitrix
owner: prec
ref_user: nitrix!~nitrix@haskell/developer/nitrix
type: text
action:
  defined by the C standard as an addressable unit of storage large enough to hold a character value.  The char type is byte-sized and is at least 8 bits wide.  CHAR_BIT in <limits.h> defines the byte size for any given implementation.  The term "byte" is often used to mean 8 bits; however, the term "octet" is preferred.


index1: #c
index2: c++
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: NeverDream
ref_user: Bou!~boudewijn@user/bou
type: text
action:
  /say If you are using a C++ compiler then your code is not C -- even if you're only using the "C subset". As soon as you invoke a C++ compiler instead of a C compiler, all the rules and idiosyncrasies of the C++ specification come into play, which have subtle differences in certain  semantics. Please ask ##c++ or switch to a C compiler.


index1: #c
index2: c/c++
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: pragma-
owner: pragma_
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  a misnomer.  These two languages are completely different languages with each having its own standard.  C++ is not a "superset" of C.  For C++ questions, please join #C++


index1: #c
index2: c13
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: circle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: circle!~a@user/ick
type: text
action:
  /say C Aphorism 13: The newbie will fail to recognize undefined behavior, and will wrongly think that their program is correct because it appears to work.


index1: #c
index2: c14
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: circle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: circle!~a@user/ick
type: text
action:
  /say C Aphorism 14: The more the querent attempts to describe their problem, the less coherent their description becomes.


index1: #c
index2: c15
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: circle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: circle!~a@user/ick
type: text
action:
  /say C Aphorism 15: When multiple people respond to the querent's problem, the questioner will focus on the person giving incorrect advice and ignore everybody else.


index1: #c
index2: c1x
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: pragma-
owner: pragma_
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say C1X/C11 draft: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf - C1X Charter: http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1250.pdf - C1X Overview: http://en.wikipedia.org/wiki/C1X - Changes from C99: http://en.wikipedia.org/wiki/C1X#Changes_from_C99 - C Overview: http://en.wikipedia.org/wiki/C_programming - HTML draft: http://port70.net/~nsz/c/c11/n1570.html


index1: #c
index2: c1xdiffs
last_referenced_in: pragma-
owner: pragma_
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  http://en.wikipedia.org/wiki/C1X#Changes_from_C99 and http://www.iso-9899.info/n1570.html#FOREWORD.p6


index1: #c
index2: c2
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: circle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: circle!~a@user/ick
type: text
action:
  /say C Aphorism 2: All examples given by the querent will be incomplete, misleading, broken, wrong, and/or not representative of the actual question.


index1: #c
index2: c3
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: circle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: circle!~a@user/ick
type: text
action:
  /say C Aphorism 3: The querent will not read and apply the answers they are given but will instead continue to practice c1 and c2.


index1: #c
index2: c7
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: circle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: circle!~a@user/ick
type: text
action:
  /say C Aphorism 7: The querent will paste code and say "I have a problem" or "It doesn't work" without any further information or description of the problem.


index1: #c
index2: c89
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: dfp
owner: Wulf4
ref_user: DFP!~DFP@109.72.102.214
type: text
action:
  /say C89/C90 draft: http://port70.net/~nsz/c/c89/c89-draft.html or http://flash-gordon.me.uk/ansi.c.txt or http://web.archive.org/web/20050207005628/http://dev.unicals.com/papers/c89-draft.html or https://archive.org/download/federalinformati160nati/federalinformati160nati.pdf - C Overview: http://en.wikipedia.org/wiki/C_programming


index1: #c
index2: c94
last_referenced_in: ##c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: FUZxxl!~fuz@d00m.org
type: text
action:
  c89 plus normative addendum 1 ( http://www.lysator.liu.se/c/na1.html ); sometimes referred to as c95.


index1: #c
index2: c99
action_with_args: /call cstd -std=C99
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c
owner: pragma_
ref_user: pekster!~rewt@user/pekster
type: text
action:
  /say C99 + TC1,2,3 working paper: https://open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf - C99 Overview: http://en.wikipedia.org/wiki/C99 - Changes from C89/C90: http://home.datacomm.ch/t_wolf/tw/c/c9x_changes.html - C Overview: http://en.wikipedia.org/wiki/C_programming - HTML version: http://port70.net/~nsz/c/c99/n1256.html


index1: #c
index2: c99vim
last_referenced_in: #pbot2
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: whoisxy!~whoisxy@82.112.144.183
type: text
action:
  /say A Standard C vim syntax file: http://www.vim.org/scripts/script.php?script_id=234 -- adds numerous improvements to vim C syntax highlighting, including C99 features and more!


index1: #c
index2: call by value
owner: sickle
ref_user: nobody
type: text
action:
  /say "In C, all function arguments are passed ‘‘by value.’’ This means that the called function is given the values of its arguments in temporary variables rather than the originals." (K&R)


index1: #c
index2: callback
edited_by: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
last_referenced_in: xatenev
owner: kate!~kate@unaffiliated/kate
ref_user: Xatenev!~I@87.190.19.178
type: text
action:
  /say A callback function abstracts some aspect of work which is independent of a particular algorithm. An implementation of that algorithm is passed a pointer to that function, and "calls back" for the abstracted work to be done. For code samples, see: http://www.iso-9899.info/wiki/Callback


index1: #c
index2: callbacks
last_referenced_in: ##spinach
owner: Feel1E6dOLARZ!~uuhimhere@1.9.98.51
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  the informal name given to a technique where a function takes in, as arguments, other functions by way of pointers allowing access to multiple functions of the same prototype (per argument). In essence it provides, for each passed argument, algorithm-agnostic function switching/access


index1: #c
index2: calloc
last_referenced_in: koisoke
owner: Feel1E6dOLARZ!~uuhimhere@1.9.98.51
ref_user: koisoke!xef4@epilogue.org
type: text
action:
  a function that allocates a block of memory for an array of "num" elements, each of them "size" bytes long, AND initializes all its bits to zero. The effective result is the allocation of a zero-initialized memory block of (num*size) bytes. see http://claudihome.com/html/LR/function_reference/Content/c_language/lrFuncRef_CLang_calloc.htm


index1: #c
index2: cam
last_referenced_in: ##c
owner: angstrom
ref_user: CaZe!~caze@unaffiliated/caze
type: text
action:
  The C Abstract Machine - An abstract machine used for reasoning about the semantics described in the C-std, in which issues of optimization are irrelevant.


index1: #c
index2: canihaztehcodez
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: FUZxxl!~fuz@d00m.org
ref_user: fstd!~fstd@unaffiliated/fisted
type: text
action:
  /say ##c is not the place to have others do your homework. If you don't understand parts of your assignment, feel free to ask but don't expect others to do your homework.


index1: #c
index2: casting
last_referenced_in: ##c
owner: pragma_
ref_user: korans!~korans@83.137.252.187
type: text
action:
  http://web.archive.org/web/20060228210010/http://www.cognitiveprocess.com/~rjh/prg/writings/casting.html


index1: #c
index2: cbreak
edited_by: jp!ayy@cpe-76-173-133-37.hawaii.res.rr.com
last_referenced_in: ##c
owner: jp!ayy@cpe-76-173-133-37.hawaii.res.rr.com
ref_user: aozt!~aozt@unaffiliated/aozt
type: text
action:
  /say Reading characters from stdin without line-buffering requires non-standard solutions like termios, ncurses, or conio. See: http://www.c-faq.com/osdep/cbreak.html


index1: #c
index2: changreet
edited_by: fstd!~fstd@unaffiliated/fisted
last_referenced_in: aozt
owner: fstd!~fstd@unaffiliated/fisted
ref_user: aozt!~aozt@unaffiliated/aozt
type: text
action:
  /say Please do not greet the channel. It adds no value to the conversation, and highlights the channel tab for no good reason.


index1: #c
index2: char
last_referenced_in: left_turn
owner: s00p
ref_user: Left_Turn!~Matthew@2a00:23c8:5f85:3301:55f0:c6ef:bde2:4460
type: text
action:
  /say char is required to be able to represent (at least) the values inclusively between -127 and 127 (signed char), or 0 and 255 (unsigned char). The representation chosen is implementation-defined, meaning some compilers will treat a char as signed, others unsigned. sizeof (char) is always 1. See also: CHAR_BIT, CHAR_MIN, CHAR_MAX and byte


index1: #c
index2: char*a,b
last_referenced_in: #pbot2
owner: Random832
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  /say The declaration "char* a, b" declares a as a pointer to char and b as a char - it does not declare b as a pointer to char.


index1: #c
index2: char_bit
last_referenced_in: ##c
owner: defrost
ref_user: Wulf!~Wulf@unaffiliated/wulf
type: text
action:
  #include <limits.h> - maximum value for the number of bits used to represent an object of type char. - >= 8


index1: #c
index2: char_max
last_referenced_in: ##c
owner: defrost
ref_user: s00p
type: text
action:
  #include <limits.h> - maximum value for type char. Its value is: SCHAR_MAX if char represents negative values, UCHAR_MAX otherwise. - >= 127


index1: #c
index2: char_min
last_referenced_in: ##c-offtopic
owner: defrost
ref_user: qwename!~qwename@unaffiliated/qwename
type: text
action:
  #include <limits.h> - minimum value for type char. Its value is: SCHAR_MIN if char represents negative values, zero otherwise. - <= 0


index1: #c
index2: chill
last_referenced_in: bou
owner: notadev
ref_user: Bou!sid274843@user/bou
type: text
action:
  /say OK, it's getting a little hairy, and really we're all here because we love C. So relax, take a walk, have a cuppa, whatever. Er.. please? ;)


index1: #c
index2: chist
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: pragma-
owner: pragma_
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say The Development of the C Language, by Dennis M. Ritchie: http://www.bell-labs.com/usr/dmr/www/chist.html or http://port70.net/~nsz/c/c89/dmr_the_development_of_the_c_language.pdf


index1: #c
index2: clang-analyze
edited_by: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
last_referenced_in: alphazulu
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: alphazulu!~alphazulu@173-228-31-194.dsl.static.fusionbroadband.com
type: text
action:
  /say Clang has a static analysis tool that can be used with the flag '--analyze'. https://clang-analyzer.llvm.org/


index1: #c
index2: clever
last_referenced_in: ##c-offtopic
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: nil!~n@monade.li
type: text
action:
  /say C was not designed to stop its users from doing stupid things, as that would also stop them from doing clever things.


index1: #c
index2: cmethods
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say Proposal to add methods() to C structures: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1816.pdf (Briefly discussed in section 6.3 (page 8) of http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1820.pdf) and also http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1875.htm


index1: #c
index2: commoninitialsequence
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say If you have multiple structs that share a common initial sequence, you can generalize the access to this sequence by either containing the sequence within a sub-struct, or by using a union to contain the structs. See: http://www.iso-9899.info/wiki/Common_Initial_Sequence


index1: #c
index2: compilerline
last_referenced_in: pekster
owner: PoppaVic
ref_user: pekster!~rewt@user/pekster
type: text
action:
  /say Order Matters: CC <overall options> [-std=whatever] <debugging> <optimizing> <warnings> [-pedantic] <Other Include Paths> <Other Lib Paths> <Magic Defines> <Magic Undefines> [-f<language/platform options] [-m<machine options>] [-o outfile] files..... (this is all documented, and files can be .c or .o, .a or .so, or -l<to be linked> commands.) <paraphrased from man gcc>


index1: #c
index2: const
last_referenced_in: #c
owner: prec
ref_user: omegatron!~some@p54849ce0.dip0.t-ipconnect.de
type: text
action:
  http://publications.gbdirect.co.uk/c_book/chapter8/const_and_volatile.html - see section 8.4.1, http://c-faq.com/ansi/constmismatch.html


index1: #c
index2: constconstant
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: dorp!~dorp@46-116-103-163.bb.netvision.net.il
type: text
action:
  /say The const qualifier is not the same as a constant. The following code sample is not required to compile: const int i = 123; int y = i; int main(void) {}


index1: #c
index2: container
last_referenced_in: pragma-
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say A container/collections library proposal for C: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1625.pdf


index1: #c
index2: conversions
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: pragma-
ref_user: Bill_Gates!~misha@169-0-74-201.ip.afrihost.co.za
type: text
action:
  /say Understanding integer conversion/promotion rules: https://www.securecoding.cert.org/confluence/display/c/INT02-C.+Understand+integer+conversion+rules


index1: #c
index2: coroutines
last_referenced_in: dpa
owner: pragma_
ref_user: DPA!~DPA@75-128-16-94.static.cable.fcom.ch
type: text
action:
  /say Co-routines in C, using Duff's Device: http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html


index1: #c
index2: cp
last_referenced_in: ##c-offtopic
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say Computer programming is a process that leads from an original formulation of a problem to executable programs. It involves activities such as analysis, understanding, and generically solving such problems resulting in an algorithm, verification of requirements (including correctness, resource consumption, etc) and maintaining the source code.


index1: #c
index2: cpp
last_referenced_in: humm
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: humm!37efd3903b@user/humm
type: text
action:
  /say The term "cpp" in the context of the C programming language refers to the C preprocessor.  If you meant C++, then say "C++".


index1: #c
index2: cpp-com
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: luka00
owner: n00p
ref_user: Luka00!~chatzilla@78-134-48-170.v4.ngi.it
type: text
action:
  /say cplusplus-dot-com is a C++-related website that happens to reference C89 functions. Many of the examples given are actually C++ because they use 'headers' such as <cstdio> instead of <stdio.h>. A better reference would be the C99/C11 standard.


index1: #c
index2: cppcheck
last_referenced_in: cousteau
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: cousteau!~cousteau@84.139.11.37.dynamic.jazztel.es
type: text
action:
  /say Cppcheck is a static analysis tool that can diagnose things common compilers do not. http://cppcheck.sourceforge.net/


index1: #c
index2: cprogramming.com
last_referenced_in: ##c
owner: n00p
ref_user: Random832!~random@unaffiliated/random832
type: text
action:
  /say cprogramming.com is not a site to be recommended to C learners because it "provide you with C and C++ programming language resources". Find a resource that distinctly teaches C to avoid confusion. See !books.


index1: #c
index2: crappaste
last_referenced_in: ##c
owner: fstd!~fstd@unaffiliated/fisted
ref_user: shadowchaser!~Shadowcha@liox.eu
type: text
action:
  /say Paste sites to be avoided include: codepaste.net, paste.awesom.eu, paste.jhvisser.com, paste.ofcode.org, paste.ubuntu.com, paste2.org, pastebin.fr, pastebin.ubuntu.com, pastee.org, vpaste.net, www.pasteall.org.  These sites make it unnecessarily difficult to access the raw paste data, making it less likely for you to get help with.  See the channel topic for recommended sites.


index1: #c
index2: decay
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: tk!~tk@ircpuzzles/staff/tk
type: text
action:
  /say Decaying implies permanence. Arrays do not "decay"; it is the expression that is converted, not the array. In most cases, an expression that has type "array of T" is converted to an expression with type "pointer to T" that points at the first element. See C11 6.3.2.1p3 for the exceptions.


index1: #c
index2: declaredefine
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: kate`
ref_user: dorp!~dorp@85-250-61-34.bb.netvision.net.il
type: text
action:
  /say A declaration specifies the interpretation and attributes of a set of identifiers. A definition of an identifier is a declaration for that identifier that: for an object, causes storage to be reserved for that object; for a function, includes the function body; for an enumeration constant or typedef name, is the (only) declaration of the identifier.


index1: #c
index2: declareuse
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say In C, declaration follows use. That means you do not write `char* p` but instead `char *p` because it doesn't mean `p is a pointer to char` but rather `*p is a char`.  https://www.quora.com/Why-doesnt-C-use-better-notation-for-pointers/answer/Brian-Bi and https://old.reddit.com/r/c_language/comments/i6iqp4/returning_function_pointer_with_and_without/


index1: #c
index2: deepc
last_referenced_in: ##c-offtopic
owner: boru!~boru@unaffiliated/boru
ref_user: Remavas!Remavas@gateway/shell/xshellz/x-Remavas
type: text
action:
  Expert C Programming: Deep C Secrets by Peter van der Linden. It assumes some foundation in the C programming language and covers its dustier corners as well as common misconceptions, such as array-pointer equivalence. See: http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298


index1: #c
index2: defaultarguments
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say { void f(int x, int y /* default 42 */, char *z /* default "foo" */) { printf("[%d, %d, %s]\n", x, y, z); }   #define F1(...) f(__VA_ARGS__, 42, "foo")\n #define F2(...) f(__VA_ARGS__, "foo")\n #define F3(...) f(__VA_ARGS__)\n #define FX(_1, _2, _3, n, ...) n\n #define f(...) FX(__VA_ARGS__, F3(__VA_ARGS__), F2(__VA_ARGS__), F1(__VA_ARGS__), 0)\n    f(2); f(4, 8); f(16, 32, "bar"); }


index1: #c
index2: designatedinitializer
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
type: text
action:
  /say C99 added designators for initializers. Designator for an element of an array: int arr[3] = { [2] = 42 }; Designator for a member of a struct (or union): struct { int x; int y; } s = { .y = 42 };


index1: #c
index2: diagnostics
edited_by: nitrix!~nitrix@user/meow/nitrix
last_referenced_in: nitrix-mas
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: nitrix-mas!~nitrix@user/nitrix
type: text
action:
  /say Diagnostics can help you find issues with your code. For decent diagnostics you should compile your code using gcc or clang with the flags: -std=c17 -Wall -Wextra -Wpedantic. See also: clang-analyze, cppcheck, and valgrind


index1: #c
index2: diamond
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: pragma_
ref_user: nil!~n@monade.li
type: text
action:
  cc -paste int ml = 1 + 2 * 3, ls = 1, is = 2, i = 0, cp = (ml - ls) / 2; while( ls > 0 ) putchar((i < cp + ls) ? ((i++ < cp) ? ' ' : '*') : (i=0, ((ls == ml) ? is = -is : 0), ls += is, cp = (ml - ls) / 2, '\n'));


index1: #c
index2: digraph
last_referenced_in: dave0
owner: twkm
ref_user: dave0!~dave@042.d.003.ncl.iprimus.net.au
type: text
action:
  a two character alternative punctuator, intended to make using c possible on systems where the primary punctuator is missing, typically from keyboards. they are normal tokens, so are processed in the same way as other source characters (apart from trigraphs).


index1: #c
index2: doesntcare
edited_by: Maxdamantus!~Maxdamant@2001:470:f078::dead:beef:cafe
last_referenced_in: ##c
owner: pragma_
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say Standard C neither knows nor cares about colors, mice, windows, keyboards, networks or any other system-specific things. If you wanted help with something like that, you would want to tell us what OS, compiler, tools or libraries you intend to use/abuse, or find the appropriate channel.


index1: #c
index2: dontcastmalloc
edited_by: edk!edk@unaffiliated/edk
last_referenced_in: #c
owner: infobahn
ref_user: ski!~ski@remote11.chalmers.se
type: text
action:
  /say There is no need to cast the result of library functions that return void *; it makes your code hard to read, adds no value, and can hide a bug if you don't have a valid prototype in scope.  See http://c-faq.com/malloc/mallocnocast.html


index1: #c
index2: double
last_referenced_in: ##c
owner: pragma_
ref_user: seebs!~seebs@24.196.59.174
type: text
action:
  /say When taking input for type double you need to use lf format specifier in the scanf statement. But when you are outputting a double you use f format specifier in the printf statements.


index1: #c
index2: dreams
last_referenced_in: ##spinach
owner: dansan!~daniel@2600:1700:be30:d00::49
ref_user: Ranhir!~Ranhir@157.97.53.139
type: text
action:
  Dreams are the subconscious mind's way of reminding people to go to school naked and have their teeth fall out.


index1: #c
index2: duffs-device
owner: defrost
ref_user: nobody
type: text
action:
  magical old school technique to directly express general loop unrolling in C. see http://www.lysator.liu.se/c/duffs-device.html


index1: #c
index2: eof
last_referenced_in: wulf
owner: infobahn
ref_user: Wulf!~Wulf@unaffiliated/wulf
type: text
action:
  an integer constant expression, with type int and a negative value, that is returned by several functions to indicate end-of-file (ISO/IEC 9899:1999 7.19.1p3). It is NOT a char. It is NOT a byte that is stored at the end of every file.


index1: #c
index2: errata
edited_by: edk!~edk@spy/edk0
last_referenced_in: #c
owner: cousteau!~cousteau@138.100.74.81
ref_user: cow_2001!~un@user/cow-2001/x-5712099
type: text
action:
  /say When reading The C Programming Language, 2nd edition, by Kernighan and Ritchie, make sure you check the errata as well: http://www.iso-9899.info/2ediffs.html


index1: #c
index2: errno
last_referenced_in: ##c
owner: defrost
ref_user: twkm!twkm@rfc1459.net
type: text
action:
  library error macro, #include <errno.h> The macro designates a modifiable int object that is asigned a value greater than zero on certain library errors. see http://www.iso-9899.info/man?strerror


index1: #c
index2: exit_failure
last_referenced_in: #cjeopardy
owner: mauke
ref_user: phale!~synt@unaffiliated/glimmer
type: text
action:
  a macro defined in <stdlib.h> whose value can be passed to exit() or returned from main() to indicate unsuccessful termination


index1: #c
index2: exit_success
last_referenced_in: ##c
owner: mauke
ref_user: nai!~naim@nai.im
type: text
action:
  a macro defined in <stdlib.h> whose value can be passed to exit() or returned from main() to indicate successful termination


index1: #c
index2: fam
last_referenced_in: #c
owner: Wulf
ref_user: caze`!~caze@user/caze
type: text
action:
  /say The last element of a structure with more than one named member may have an incomplete array type; this is called a flexible array member (C99 6.7.2.1p16). struct s { int n; double d[]; } *p = malloc(sizeof *p + 17 * sizeof *p->d);


index1: #c
index2: fd
last_referenced_in: ##c
owner: PoppaVic!~pops@unaffiliated/poppavic
ref_user: nHeck!~heck@unaffiliated/nheck
type: text
action:
  /say an 'fd' is POSIX. Getting an 'fd' from or to a FILE pointer is POSIX. ##posix is right down the hall.


index1: #c
index2: feof
last_referenced_in: ##c
owner: Major-Willard
ref_user: hexoskeli!~hexoskeli@2601:640:8300:5a90:cb:bbba:4673:5305
type: text
action:
  a function, taking one FILE * as an argument, indicating a file has been completely read by getc/getchar/fread (not a recommended construct)


index1: #c
index2: foobar
edited_by: nitrix!~nitrix@unaffiliated/nitrix
last_referenced_in: #wordle
owner: pragma-
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say English metasyntactic variables: foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud; UK: wibble, wobble, wubble; French: toto, titi, tata, tutu


index1: #c
index2: generalization
edited_by: nitrix!~nitrix@unaffiliated/nitrix
last_referenced_in: xatenev
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: Xatenev!~xatenev@user/xatenev
type: text
action:
  /say There's little need to make generalizations about people who program with C. Some have interesting prejudices, others don't. In any case it will depend on the individual, and not the fact that they have a preference for a particular language.


index1: #c
index2: genericfunctionpointer
edited_by: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: dorp!~dorp@85-250-41-117.bb.netvision.net.il
type: text
action:
  /say You can convert a function pointer of one type to a function pointer of a different type for passing it as an argument to a function, but upon calling the function the pointed-to type should be compatible*. See http://www.iso-9899.info/wiki/Generic_Function_Pointer


index1: #c
index2: genericpointertopointer
last_referenced_in: ##c-offtopic
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: nf!~n@monade.li
type: text
action:
  /say A pointer to pointer to void (void **) is not the same as a pointer to void. It is not required to be convertible to other types of pointers to pointers, and it is not a generic pointer to pointer. See http://www.iso-9899.info/wiki/Generic_Pointer_To_Pointer


index1: #c
index2: getline
edited_by: Random832!~random@unaffiliated/random832
last_referenced_in: #c-offtopic
owner: Random832!~random@unaffiliated/random832
ref_user: nf!~n@monade.li
type: text
action:
  declared in stdio.h in POSIX 2008, but is not a standard C function. To compile your own code that defines a "getline" function, you may need to use -ansi or make sure you are not using POSIX (or GNU) feature test macros. On Mac OS X, use -D_ANSI_SOURCE.


index1: #c
index2: getopt
last_referenced_in: blasthardcheese
owner: Quetzalcoatl_
ref_user: BlastHardcheese
type: text
action:
  a C library function for parsing command-line arguments. It is found on Linux, BSD, and other Unix systems.


index1: #c
index2: gets
last_referenced_in: xatenev
owner: pragma_
ref_user: Xatenev!~xatenev@user/xatenev
type: text
action:
  very bad.  It cannot be told the size of the buffer to read in, therefore it has no way of preventing buffer overflows.  Use fgets() with 'stdin' as the FILE* instead.  http://www.eskimo.com/~scs/C-faq/q12.23.html


index1: #c
index2: github
last_referenced_in: nai
owner: s00p
ref_user: nai!~naim@nai.im
type: text
action:
  /say Don't use github for pasting. The line numbers are in a different font size to the code, and as a result they don't line up with lines of code correctly.


index1: #c
index2: glib-pcre
last_referenced_in: aozt
owner: aozt!~aozt@unaffiliated/aozt
ref_user: aozt!~aozt@unaffiliated/aozt
type: text
action:
  /say PCRE functionality is also offered by glib (where strings are always encoded in UTF-8). See: https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html and https://developer.gnome.org/glib/stable/glib-regex-syntax.html


index1: #c
index2: global
last_referenced_in: #c-offtopic
owner: n00p
ref_user: Bou!~boudewijn@user/bou
type: text
action:
  /say There is no "global" scope in C. There are four kinds of scopes: function, file, block, and function prototype. A variable that appears outside of any block or list of parameters has file scope, which terminates at the end of the translation unit.


index1: #c
index2: gnu-errno-name-num
edited_by: nai!~naim@monade.li
last_referenced_in: nai
owner: aozt!~aozt@unaffiliated/aozt
ref_user: nai!~naim@monade.li
type: text
action:
  /say GNU cpp can produce a list of #define directives if you run it with the -dM option, you can use this feature to list errno macro names and numbers: cpp -dM <<<$'#define _GNU_SOURCE\n#include <errno.h>' | grep '^#define E' | sort -k3n


index1: #c
index2: googlearn
last_referenced_in: glacial
owner: glacial!~glacial@unaffiliated/glacial
ref_user: glacial!~glacial@unaffiliated/glacial
type: text
action:
  Google is NOT a preferred source for learning C, because almost all the "tutorials" and examples out there are JUNK. Instead, ask a good question here, pick a book, or refer to the current C standard (see topic)


index1: #c
index2: goto
last_referenced_in: #c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: cousteau!~cousteau@user/cousteau
type: text
action:
  /say Goto statements can be useful for cleaning up or breaking out of nested loops/switches. See cleanup and http://www.iso-9899.info/wiki/Goto


index1: #c
index2: h&s
last_referenced_in: #c
owner: heina
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  "C - A Reference Manual" by Harbison & Steele; a reference for C on par with K&R - http://www.amazon.com/Reference-Manual-Samuel-P-Harbison/dp/013089592X


index1: #c
index2: hacker
last_referenced_in: tactical_man
owner: fstd!~fstd@unaffiliated/fisted
ref_user: Tactical_Man!~HacKeR_Ga@103.254.131.98
type: text
action:
  /say http://dejimachan.org/pb/player.php?v=/pb/tg/src/1442078700826.webm&t=haxx0r_pro.webm&loop=1 (NSFW)


index1: #c
index2: hd
last_referenced_in: #pbot2
owner: boru!~boru@unaffiliated/boru
ref_user: cousteau!~cousteau@unaffiliated/cousteau
type: text
action:
  Hacker's Delight by Henry S. Warren Jr. It discusses the use of boolean algebra and bitwise operations to reduce the computational complexity of algorithms. See http://www.hackersdelight.org and http://www.amazon.com/Hackers-Delight-Edition-Henry-Warren/dp/0321842685


index1: #c
index2: heap
edited_by: nitrix!~nitrix@user/nitrix
last_referenced_in: nitrix
owner: guidj0s
ref_user: nitrix!~nitrix@user/meow/nitrix
type: text
action:
  /say C does not require implementations to use stacks or heaps. Instead, there are four storage durations: automatic, allocated, static and thread.


index1: #c
index2: identifier
last_referenced_in: oldlaptop
owner: Wulf
ref_user: oldlaptop!~quassel@45.63.78.126
type: text
action:
  /say An identifier can denote an object; a function; a tag or a member of a structure, union, or enumeration; a typedef name; a label name; a macro name; or a macro parameter. The same identifier can denote different entities at different points in the program.


index1: #c
index2: implementation
last_referenced_in: #cjeopardy
owner: pragma_
ref_user: whoisxy!~whoisxy@87.244.100.104
type: text
action:
  a particular set of software, running in a particular translation environment under particular control options, that performs translation of programs for, and supports execution of functions in, a particular execution environment (ISO/IEC 9899:1999 3.12)


index1: #c
index2: incomplete
last_referenced_in: #c-jeopardy
owner: Wulf
ref_user: Ckat!~Ckat@xn--z7x.xn--6frz82g
type: text
action:
  /say A type which describes an object is incomplete if it lacks information needed to determine its size.


index1: #c
index2: indent
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c
owner: prev!~prev@unaffiliated/prev
ref_user: dave0!~dave0@069.d.003.ncl.iprimus.net.au
type: text
action:
  /say If you are not experienced enough to adhere to coding style allowing production of readable C code, brush your source automatically: using GNU indent http://gnu.org/s/indent/, using clang-format http://clang.llvm.org/docs/ClangFormat.html, or using astyle http://astyle.sourceforge.net/


index1: #c
index2: initidiom
last_referenced_in: #c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: tk!~tk@ircpuzzles/staff/tk
type: text
action:
  /say A common idiom for zero initializing elements of arrays or members of structs (automatic storage duration) is: char arr[10] = { 0 }; struct { int x; int y;} s = { 0 };


index1: #c
index2: inline
edited_by: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
last_referenced_in: #c
owner: Wulf
ref_user: cousteau!~cousteau@user/cousteau
type: text
action:
  /say A function declared with an inline function specifier is an inline function. Making a function an inline function suggests that calls to the function be as fast as possible. If you use `inline', always use `static', too. See https://kellett.im/a/inline


index1: #c
index2: int
last_referenced_in: #c
owner: infobahn
ref_user: bubuche87!~bubuche87@169.150.218.84
type: text
action:
  a signed integer data type, at least 16 bits wide, which must be able to represent (at least) all the numbers in the range -32767 to +32767. Its lowest value, INT_MIN, and highest value, INT_MAX, are defined in <limits.h>


index1: #c
index2: int-str
last_referenced_in: ##c
owner: o11c!~ben@unaffiliated/o11c
ref_user: o11c!~ben@unaffiliated/o11c
type: text
action:
  To convert an int to a string without knowing whether it is signed, see https://gist.github.com/o11c/0f117636d6c8873d5cc6f63347ee4fdd


index1: #c
index2: k&r
action_with_args: /call kr$args
edited_by: edk!~edk@spy/edk0
last_referenced_in: ic56
owner: Chris
ref_user: ic56!~ic56@user/ic56
type: text
action:
  The C Programming Language, 2nd edition, by Kernighan and Ritchie -- http://wayback.archive-it.org/5263/20150203070038/http://cm.bell-labs.com/cm/cs/cbook/ -- errata: http://www.iso-9899.info/2ediffs.html


index1: #c
index2: k&r3
edited_by: izabera!~izabera@unaffiliated/izabera
last_referenced_in: ##c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: Hello71!Hello71@unaffiliated/hello71
type: text
action:
  /say Some of us no longer primarily recommend K&R because it's somewhat outdated and unmaintained. It's tiresome reminding would-be readers of implicit int's removal in modern C, among many other issues. The errata that addresses only some of these issues no longer exists on the official site. If a 3rd edition of K&R emerges that rectifies these issues, we'll happily recommend it again!


index1: #c
index2: k&rking
edited_by: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
last_referenced_in: meator
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: meator!~meator@user/meator
type: text
action:
  /say 'The C Programming Language' (2nd Ed, 1988) aka K&R2, is a book that teaches C89, it has a lengthy errata and it contains 'old style' things. The book is short (272 pages) and as such less informative. 'C Programming: A Modern Approach' by K. N. King (2nd Ed, 2008) covers both C89 and C99, it's very much informative and therefore lengthy (832 pages).


index1: #c
index2: king
edited_by: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
last_referenced_in: #c
owner: izabera!~izabera@unaffiliated/izabera
ref_user: smol-hors!sid524992@smol/hors
type: text
action:
  /say 'C Programming: A Modern Approach' by K. N. King (2nd Ed, 2008) is a recommended C book that teaches both C89 and C99. http://knking.com/books/c2/index.html


index1: #c
index2: kr1-1
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: caze!~caze@unaffiliated/caze
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-1. Run the ‘‘hello, world’’ program on your system. Experiment with leaving out parts of the program, to see what error messages you get.


index1: #c
index2: kr1-10
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: kodcode!~kodcode@user/kodcode
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-10. Write a program to copy its input to its output, replacing each tab by \t, each backspace by \b, and each backslash by \\. This makes tabs and backspaces visible in an unambiguous way.


index1: #c
index2: kr1-11
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: kodcode!~kodcode@user/kodcode
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-11. How would you test the word count program? What kinds of input are most likely to uncover bugs if there are any?


index1: #c
index2: kr1-12
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-12. Write a program that prints its input one word per line.


index1: #c
index2: kr1-13
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-13. Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging.


index1: #c
index2: kr1-14
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-14. Write a program to print a histogram of the frequencies of different characters in its input.


index1: #c
index2: kr1-15
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-15. Rewrite the temperature conversion program of Section 1.2 to use a function for conversion.


index1: #c
index2: kr1-16
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-16. Revise the main routine of the longest-line program so it will correctly print the length of arbitrary long input lines, and as much as possible of the text.


index1: #c
index2: kr1-17
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: caze!~caze@user/caze
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-17. Write a program to print all input lines that are longer than 80 characters.


index1: #c
index2: kr1-18
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: caze!~caze@user/caze
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-18. Write a program to remove trailing blanks and tabs from each line of input, and to delete entirely blank lines.


index1: #c
index2: kr1-19
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-19. Write a function reverse(s) that reverses the character string s. Use it to write a program that reverses its input a line at a time.


index1: #c
index2: kr1-2
last_referenced_in: #c-offtopic
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-2. Experiment to find out what happens when prints’s argument string contains \c, where c is some character not listed above.


index1: #c
index2: kr1-20
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-20. Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns. Should n be a variable or a symbolic parameter?


index1: #c
index2: kr1-21
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-21. Write a program entab that replaces strings of blanks by the minimum number of tabs and blanks to achieve the same spacing. Use the same tab stops as for detab. When either a tab or a single blank would suffice to reach a tab stop, which should be given preference?


index1: #c
index2: kr1-22
last_referenced_in: pragma-
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-22. Write a program to ‘‘fold’’ long input lines into two or more shorter lines after the last non-blank character that occurs before the n-th column of input. Make sure your program does something intelligent with very long lines, and if there are no blanks or tabs before the specified column.


index1: #c
index2: kr1-23
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: caze!~caze@user/caze
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-23. Write a program to remove all comments from a C program. Don’t forget to handle quoted strings and character constants properly. C comments don’t nest.


index1: #c
index2: kr1-24
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: caze!~caze@user/caze
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-24. Write a program to check a C program for rudimentary syntax errors like unmatched parentheses, brackets and braces. Don’t forget about quotes, both single and double, escape sequences, and comments. (This program is hard if you do it in full generality.)


index1: #c
index2: kr1-3
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: devansh1302!~androirc@59.180.175.107
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-3. Modify the temperature conversion program to print a heading above the table.


index1: #c
index2: kr1-4
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: kate!~kate@unaffiliated/kate
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-4. Write a program to print the corresponding Celsius to Fahrenheit table.


index1: #c
index2: kr1-5
last_referenced_in: #c-offtopic
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-5. Modify the temperature conversion program to print the table in reverse order, that is, from 300 degrees to 0.


index1: #c
index2: kr1-6
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: caze`!~caze@user/caze
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-6. Verify that the expression getchar() != EOF is 0 or 1.


index1: #c
index2: kr1-8
last_referenced_in: sham1
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: sham1!~sham1@212-146-44-107.aboa.net
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-8. Write a program to count blanks, tabs, and newlines.


index1: #c
index2: kr1-9
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Wulf!~Wulf@user/wulf
type: text
action:
  /say Chapter 1: A Tutorial Introduction; Exercise 1-9. Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank.


index1: #c
index2: kr2-1
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: cow_2001!~un@user/cow-2001/x-5712099
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-1. Write a program to determine the ranges of char, short, int, and long variables, both signed and unsigned, by printing appropriate values from standard headers and by direct computation. Harder if you compute them: determine the ranges of the various floating-point types.


index1: #c
index2: kr2-10
last_referenced_in: instance9
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: instance9!~instance9@user/instance9
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-10. Rewrite the function lower, which converts upper case letters to lower case, with a conditional expression instead of if-else.


index1: #c
index2: kr2-2
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-2. Write a loop equivalent to the for loop above without using && or ||. [The for loop is: for (i=0; i < lim-1 && (c=getchar()) != ’\n’ && c != EOF; ++i) s[i] = c;]


index1: #c
index2: kr2-3
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: suss!~user@user/suss
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-3. Write a function htoi(s), which converts a string of hexadecimal digits (including an optional 0x or 0X) into its equivalent integer value. The allowable digits are 0 through 9, a through f, and A through F.


index1: #c
index2: kr2-4
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: cow_2001!~un@user/cow-2001/x-5712099
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-4. Write an alternative version of squeeze(s1,s2) that deletes each character in s1 that matches any character in the string s2.


index1: #c
index2: kr2-5
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: suss!~user@user/suss
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-5. Write the function any(s1,s2), which returns the first location in a string s1 where any character from the string s2 occurs, or -1 if s1 contains no characters from s2. (The standard library function strpbrk does the same job but returns a pointer to the location.)


index1: #c
index2: kr2-6
last_referenced_in: #c-offtopic
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-6. Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y, leaving the other bits unchanged.


index1: #c
index2: kr2-7
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-7. Write a function invert(x,p,n) that returns x with the n bits that begin at position p inverted (i.e., 1 changed into 0 and vice versa), leaving the others unchanged.


index1: #c
index2: kr2-8
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-8. Write a function rightrot(x,n) that returns the value of the integer x rotated to the right by n positions.


index1: #c
index2: kr2-9
last_referenced_in: pyzozord
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@86-84-110-228.fixed.kpn.net
type: text
action:
  /say Chapter 2: Types, Operators and Expressions; Exercise 2-9. In a two’s complement number system, x &= (x-1) deletes the rightmost 1-bit x. Explain why. Use this observation to write a faster version of bitcount.


index1: #c
index2: kr3-1
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 3: Control Flow; Exercise 3-1. Our binary search makes two tests inside the loop, when one would suffice (at the price of more tests outside.) Write a version with only one test inside the loop and measure the difference in run-time.


index1: #c
index2: kr3-2
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: PublicWiFi!~PublicWiF@user/publicwifi
type: text
action:
  /say Chapter 3: Control Flow; Exercise 3-2. Write a function escape(s,t) that converts characters like newline and tab into visible escape sequences like \n and \t as it copies the string t to s. Use a switch. Write a function for the other direction as well, converting escape sequences into the real characters.


index1: #c
index2: kr3-3
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: PublicWiFi!~PublicWiF@user/publicwifi
type: text
action:
  /say Chapter 3: Control Flow; Exercise 3-3. Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2. Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. Arrange that a leading or trailing - is taken literally.


index1: #c
index2: kr3-4
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: PublicWiFi!~PublicWiF@user/publicwifi
type: text
action:
  /say Chapter 3: Control Flow; Exercise 3-4. In a two’s complement number representation, our version of itoa does not handle the largest negative number, that is, the value of n equal to -(2^(wordsize-1)). Explain why not. Modify it to print that value correctly, regardless of the machine on which it runs.


index1: #c
index2: kr3-5
edited_by: marchelzo!~marchelzo@unaffiliated/marchelzo
last_referenced_in: instance9
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: instance9!~instance9@user/instance9
type: text
action:
  /say Chapter 3: Control Flow; Exercise 3-5. Write the function itob(n,s,b) that converts the integer n into a base b character representation in the string s. In particular, itob(n,s,16) formats n as a hexadecimal integer in s.


index1: #c
index2: kr3-6
last_referenced_in: pessimist
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Pessimist!Pessimist@gateway/shell/bnc4free/x-aynrofrafrmgbfxw
type: text
action:
  /say Chapter 3: Control Flow; Exercise 3-6. Write a version of itoa that accepts three arguments instead of two. The third argument is a minimum field width; the converted number must be padded with blanks on the left if necessary to make it wide enough.


index1: #c
index2: kr4-1
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-1. Write the function strindex(s,t) which returns the position of the rightmost occurrence of t in s, or -1 if there is none.


index1: #c
index2: kr4-10
last_referenced_in: nheck
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: nHeck!~heck@unaffiliated/nheck
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-10. An alternate organization uses getline to read an entire input line; this makes getch and ungetch unnecessary. Revise the calculator to use this approach.


index1: #c
index2: kr4-11
last_referenced_in: #pbot2
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: qwename!~qwename@unaffiliated/qwename
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-11. Modify getop so that it doesn’t need to use ungetch. Hint: use an internal static variable.


index1: #c
index2: kr4-12
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-12. Adapt the ideas of printd to write a recursive version of itoa; that is, convert an integer into a string by calling a recursive routine.


index1: #c
index2: kr4-13
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-13. Write a recursive version of the function reverse(s), which reverses the string s in place.


index1: #c
index2: kr4-14
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: fizzie!irc@selene.zem.fi
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-14. Define a macro swap(t,x,y) that interchanges two arguments of type t. (Block structure will help.)


index1: #c
index2: kr4-2
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: constxd!~brad@142.134.78.128
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-2. Extend atof to handle scientific notation of the form 123.45e-6 where a floating-point number may be followed by e or E and an optionally signed exponent.


index1: #c
index2: kr4-3
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: PublicWiFi!~PublicWiF@user/publicwifi
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-3. Given the basic framework, it’s straightforward to extend the calculator. Add the modulus (%) operator and provisions for negative numbers.


index1: #c
index2: kr4-4
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: fatal1ty!~kindofwon@2a02:ed1:f000:5779:3aa:85f7:9d06:e0da
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-4. Add the commands to print the top elements of the stack without popping, to duplicate it, and to swap the top two elements. Add a command to clear the stack.


index1: #c
index2: kr4-5
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-5. Add access to library functions like sin, exp, and pow. See <math.h> in Appendix B, Section 4.


index1: #c
index2: kr4-6
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: PublicWiFi!~PublicWiF@user/publicwifi
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-6. Add commands for handling variables. (It’s easy to provide twenty-six variables with single-letter names.) Add a variable for the most recently printed value.


index1: #c
index2: kr4-7
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Pheinte!~Pheinte@188.250.192.26
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-7. Write a routine ungets(s) that will push back an entire string onto the input. Should ungets know about buf and bufp, or should it just use ungetch?


index1: #c
index2: kr4-8
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: thomas_d!~thomas_d@unaffiliated/thomas-d/x-6984210
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-8. Suppose that there will never be more than one character of pushback. Modify getch and ungetch accordingly.


index1: #c
index2: kr4-9
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: marchelzo!~marchelzo@unaffiliated/marchelzo
type: text
action:
  /say Chapter 4: Functions and Program Structure; Exercise 4-9. Our getch and ungetch do not handle a pushed-back EOF correctly. Decide what their properties ought to be if an EOF is pushed back, then implement your design.


index1: #c
index2: kr5-1
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-1. As written, getint treats a + or - not followed by a digit as a valid representation of zero. Fix it to push such a character back on the input.


index1: #c
index2: kr5-10
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-10. Write the program expr, which evaluates a reverse Polish expression from the command line, where each operator or operand is a separate argument. For example, expr 2 3 4 + * evaluates 2 * (3 + 4).


index1: #c
index2: kr5-11
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-11. Modify the program entab and detab (written as exercises in Chapter 1) to accept a list of tab stops as arguments. Use the default tab settings if there are no arguments.


index1: #c
index2: kr5-12
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: atk!~Arch-TK@ircpuzzles/staff/Arch-TK
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-12. Extend entab and detab to accept the shorthand `entab -m +n` to mean tab stops every n columns, starting at column m. Choose convenient (for the user) default behavior.


index1: #c
index2: kr5-13
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: caze!~caze@unaffiliated/caze
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-13. Write the program tail, which prints the last n lines of its input. By default, n is set to 10, let us say, but it can be changed by an optional argument so that `tail -n` prints the last n lines. The program should behave rationally no matter how unreasonable the input or the value of n. Write the program so that it makes the best use of available storage; lines should be stored as in the sorting program of Section 5.6, not in a two-dimensional array of fixed size.


index1: #c
index2: kr5-14
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-14. Modify the sort program to handle a -r flag, which indicates sorting in reverse (decreasing) order. Be sure that -r works with -n.


index1: #c
index2: kr5-15
last_referenced_in: profess
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: profess!~profess@unaffiliated/csddesk
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-15. Add the option -f to fold upper and lower case together, so that case distinctions are not made during sorting; for example, a and A compare equal.


index1: #c
index2: kr5-16
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-16. Add the -d (‘‘directory order’’) option, which makes comparisons only on letters, numbers and blanks. Make sure it works in conjunction with -f.


index1: #c
index2: kr5-17
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: lilibyte!~lilibyte@89.187.178.173
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-17. Add a field-searching capability, so sorting may bee done on fields within lines, each field sorted according to an independent set of options. (The index for this book was sorted with -df for the index category and -n for the page numbers.)


index1: #c
index2: kr5-19
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-19. Modify undcl so that it does not add redundant parentheses to declarations.


index1: #c
index2: kr5-2
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-2. Write getfloat, the floating-point analog of getint. What type does getfloat return as its function value?


index1: #c
index2: kr5-20
last_referenced_in: #c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: constxd!~brad@hlfxns017vw-142-68-50-97.dhcp-dynamic.fibreop.ns.bellaliant.net
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-20. Expand dcl to handle declarations with function argument types, qualifiers like const, and so on.


index1: #c
index2: kr5-3
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-3. Write a pointer version of the function strcat that we showed in Chapter 2: strcat(s,t) copies the string t to the end of s.


index1: #c
index2: kr5-4
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-4. Write the function strend(s,t), which returns 1 if the string t occurs at the end of the string s, and zero otherwise.


index1: #c
index2: kr5-5
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-5. Write versions of the library functions strncpy, strncat, and strncmp, which operate on at most the first n characters of their argument strings. For example, strncpy(s,t,n) copies at most n characters of t to s. Full descriptions are in Appendix B.


index1: #c
index2: kr5-6
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: DuClare_!~duclare@freenet/Freetalk/developer/DuClare
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-6. Rewrite appropriate programs from earlier chapters and exercises with pointers instead of array indexing. Good possibilities include getline (Chapters 1 and 4), atoi, itoa, and their variants (Chapters 2, 3, and 4), reverse (Chapter 3), and strindex and getop (Chapter 4).


index1: #c
index2: kr5-7
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-7. Rewrite readlines to store lines in an array supplied by main, rather than calling alloc to maintain storage. How much faster is the program?


index1: #c
index2: kr5-8
last_referenced_in: anonnumberanon
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: anonnumberanon!~anonnumbe@unaffiliated/anonnumberanon
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-8. There is no error checking in day_of_year or month_day. Remedy this defect.


index1: #c
index2: kr5-9
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: Celphi!sid97751@gateway/web/irccloud.com/x-sid97751
type: text
action:
  /say Chapter 5: Pointers and Arrays; Exercise 5-9. Rewrite the routines day_of_year and month_day with pointers instead of indexing.


index1: #c
index2: kr6-1
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 6: Structures; Exercise 6-1. Our version of getword does not properly handle underscores, string constants, comments, or preprocessor control lines. Write a better version.


index1: #c
index2: kr6-2
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 6: Structures; Exercise 6-2. Write a program that reads a C program and prints in alphabetical order each group of variable names that are identical in the first 6 characters, but different somewhere thereafter. Don’t count words within strings and comments. Make 6 a parameter that can be set from the command line.


index1: #c
index2: kr6-3
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 6: Structures; Exercise 6-3. Write a cross-referencer that prints a list of all words in a document, and for each word, a list of the line numbers on which it occurs. Remove noise words like ‘‘the,’’ ‘‘and,’’ and so on.


index1: #c
index2: kr6-4
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 6: Structures; Exercise 6-4. Write a program that prints the distinct words in its input sorted into decreasing order of frequency of occurrence. Precede each word by its count.


index1: #c
index2: kr6-5
last_referenced_in: #c-offtopic
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Chapter 6: Structures; Exercise 6-5. Write a function undef that will remove a name and definition from the table maintained by lookup and install.


index1: #c
index2: kr6-6
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 6: Structures; Exercise 6-6. Implement a simple version of the #define processor (i.e., no arguments) suitable for use with C programs, based on the routines of this section. You may also find getch and ungetch helpful.


index1: #c
index2: kr7-1
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-1. Write a program that converts upper case to lower or lower case to upper, depending on the name it is invoked with, as found in argv[0].


index1: #c
index2: kr7-2
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-2. Write a program that will print arbitrary input in a sensible way. As a minimum, it should print non-graphic characters in octal or hexadecimal according to local custom, and break long text lines.


index1: #c
index2: kr7-3
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-3. Revise minprintf to handle more of the other facilities of printf.


index1: #c
index2: kr7-4
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-4. Write a private version of scanf analogous to minprintf from the previous section.


index1: #c
index2: kr7-5
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: doppel!~chatzilla@ip70-170-42-83.lv.lv.cox.net
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-5. Rewrite the postfix calculator of Chapter 4 to use scanf and/or sscanf to do the input and number conversion.


index1: #c
index2: kr7-6
last_referenced_in: instance9
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: instance9!~instance9@user/instance9
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-6. Write a program to compare two files, printing the first line where they differ.


index1: #c
index2: kr7-7
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: atk!Arch-TK@ircpuzzles/staff/Arch-TK
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-7. Modify the pattern finding program of Chapter 5 to take its input from a set of named files or, if no files are named as arguments, from the standard input. Should the file name be printed when a matching line is found?


index1: #c
index2: kr7-8
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: MethylatorX!~quassel@41.238.141.38
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-8. Write a program to print a set of files, starting each new one on a new page, with a title and a running page count for each file.


index1: #c
index2: kr7-9
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 7: Input and Output; Exercise 7-9. Functions like isupper can be implemented to save space or to save time. Explore both possibilities.


index1: #c
index2: kr8-1
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: korans!~korans@5.42.131.31
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-1. Rewrite the program cat from Chapter 7 using read, write, open, and close instead of their standard library equivalents. Perform experiments to determine the relative speeds of the two versions.


index1: #c
index2: kr8-2
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: CaZe!~caze@unaffiliated/caze
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-2. Rewrite fopen and _fillbuf with fields instead of explicit bit operations. Compare code size and execution speed.


index1: #c
index2: kr8-3
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-3. Design and write _flushbuf, fflush, and fclose.


index1: #c
index2: kr8-4
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-4. The standard library function int fseek(FILE *fp, long offset, int origin) is identical to lseek except that fp is a file pointer instead of a file descriptor and return value is an int status, not a position. Write fseek. Make sure that your fseek coordinates properly with the buffering done for other functions of the library.


index1: #c
index2: kr8-5
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-5. Modify the fsize program to print the other information contained in the inode entry.


index1: #c
index2: kr8-6
last_referenced_in: baltazar
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: baltazar!~baltazar@188-143-85-39.pool.digikabel.hu
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-6. The standard library function calloc(n,size) returns a pointer to n objects of size size, with the storage initialized to zero. Write calloc, by calling malloc or by modifying it.


index1: #c
index2: kr8-7
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-7. malloc accepts a size request without checking its plausibility; free believes that the block it is asked to free contains a valid size field. Improve these routines so they make more pains with error checking.


index1: #c
index2: kr8-8
last_referenced_in: ##c
owner: pragma-!chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@unaffiliated/pyzozord
type: text
action:
  /say Chapter 8: The UNIX System Interface; Exercise 8-8. Write a routine bfree(p,n) that will free any arbitrary block p of n characters into the free list maintained by malloc and free. By using bfree, a user can add a static or external array to the free list at any time.


index1: #c
index2: krexercises
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: constxd
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: constxd!~brad@hlfxns017vw-142-68-50-97.dhcp-dynamic.fibreop.ns.bellaliant.net
type: text
action:
  kr1-1 kr1-10 kr1-11 kr1-12 kr1-13 kr1-14 kr1-15 kr1-16 kr1-17 kr1-18 kr1-19 kr1-2 kr1-20 kr1-21 kr1-22 kr1-23 kr1-24 kr1-3 kr1-4 kr1-5 kr1-7 kr1-8 kr1-9 kr2-1 kr2-10 kr2-2 kr2-3 kr2-4 kr2-5 kr2-6 kr2-7 kr2-8 kr2-9 kr3-1 kr3-2 kr3-3 kr3-4 kr3-5 kr3-6 kr4-1 kr4-10 kr4-11 kr4-12 kr4-13 kr4-14 kr4-2 kr4-3 kr4-4 kr4-5 kr4-6 kr4-7 kr4-8 kr4-9 kr5-1 kr5-10 kr5-11 kr5-12 kr5-13 kr5-14 kr5-15 kr5-16 kr5-17 kr5-18 kr5-19 kr5-2 kr5-20 kr5-3 kr5-4 kr5-5 kr5-6 kr5-7 kr5-8 kr5-9 kr6-1 kr6-2 kr6-3 kr6-4 kr6-5 kr6-6 kr7-1 kr7-2 kr7-3 kr7-4 kr7-5 kr7-6 kr7-7 kr7-8 kr7-9 kr8-1 kr8-2 kr8-3 kr8-4 kr8-5 kr8-6 kr8-7 kr8-8


index1: #c
index2: lcthw
edited_by: mzo!~marchelzo@unaffiliated/marchelzo
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Learn C The Hard Way is an online book that should be avoided. It does not teach you C, but rather shows how C might work on a specific implementation. It contains numerous errors, bad examples and absurd arguments. See http://hentenaar.com/dont-learn-c-the-wrong-way and https://kellett.im/a/hardway


index1: #c
index2: ld
last_referenced_in: stdin@pbot
owner: boris``
ref_user: candide!stdin@pbot
type: text
action:
  /say "Undefined reference" is a linker error. It's not a compile error. #includes don't help. You did not define the thing in the error message; you forgot to link the file that defines it; you forgot to link to the library that defines it; or, if it's a static library, you have the wrong order on the linker command line. Check which one. (Note that some linkers call it an unresolved external.)


index1: #c
index2: learnc
edited_by: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say This channel is not a substitute for a C book, we are not here to teach you C. Please learn C by working through a C book, and we'll be glad to assist you during your endeavor.


index1: #c
index2: learngradually
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say Learning C should be done gradually by following a C learning resource. By taking on projects you're not ready for you are not learning C and you waste a lot of time while getting frustrated with your progress.


index1: #c
index2: libc
last_referenced_in: xatenev
owner: latch!~latch@unaffiliated/latch
ref_user: Xatenev!~xatenev@user/xatenev
type: text
action:
  /say The term "libc" is commonly used as a shorthand for the "standard C library", a library of standard functions that can be used by all C programs (and sometimes by programs in other languages).


index1: #c
index2: local
last_referenced_in: sjohnson
owner: fstd!~fstd@unaffiliated/fisted
ref_user: sjohnson!~sjohnson@cow.sj.rfc1459.net
type: text
action:
  /say There is no "local" scope in C. There are four kinds of scopes: function, file, block, and function prototype. A variable that appears inside of a function has block scope, which terminates at the end of the block.


index1: #c
index2: lock
edited_by: jp!ayy@youlosethega.me
last_referenced_in: saparok
owner: sickle
ref_user: Saparok!~Saparok@47.183.79.48
type: text
action:
  /say In computer science, a lock is a synchronization mechanism for enforcing limits on access to a resource in a concurrent execution environment


index1: #c
index2: long
last_referenced_in: #wordle
owner: infobahn
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  a signed integer data type, at least 32 bits wide, which must be able to represent (at least) all the integers in the range -2147483647 to +2147483647. Its lowest value, LONG_MIN, and highest value, LONG_MAX, are defined in <limits.h>


index1: #c
index2: longlong
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: Cobrax!~Cobrax@77.139.233.166
type: text
action:
  /say long long is a signed integer data type, at least 64 bits wide, which must be able to represent (at least) all the integers in the range -9223372036854775807 to +9223372036854775807. Its lowest value, LLONG_MIN, and highest value, LLONG_MAX, are defined in <limits.h>


index1: #c
index2: lowlevel
last_referenced_in: ##c-offtopic
owner: Sebastian!uid71324@gateway/web/irccloud.com/x-uqvndqntaomdnmvk
ref_user: esselfe!~bsfc@unaffiliated/esselfe
type: text
action:
  /say If everything remotely "low level" were to automatically become associated with C, ##C would be flooded with tonnes of irrelevant questions about assembly and hardware.


index1: #c
index2: lvalue
edited_by: edk!edk@spy/edk0
last_referenced_in: poprocks
owner: Wulf_
ref_user: poprocks!~logan@unaffiliated/poprocks
type: text
action:
  /say An lvalue is an expression that potentially designates an object. When its value is used, it is converted to the value stored in its deisgnated object. Only modifiable lvalues can be assigned to; these include non-const variables and pointer dereferences.


index1: #c
index2: macroargopt
last_referenced_in: ##c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say { #define ASSERT1(...) printf("[cond = %d]\n", __VA_ARGS__)\n  #define ASSERT2(...) printf("[cond = %d, msg = %s]\n", __VA_ARGS__)\n #define ASSERTX(a, b, n, ...) n\n #define ASSERT(...) ASSERTX(__VA_ARGS__, ASSERT2(__VA_ARGS__), ASSERT1(__VA_ARGS__), 0)\n     ASSERT(5, "hi");  ASSERT(42); }


index1: #c
index2: main
edited_by: k!~krok@unaffiliated/krok
last_referenced_in: #c
owner: twkm
ref_user: siw5ohs0!~aiw5ohs0@user/aiw5ohs0
type: text
action:
  int main(int argc, char *argv[]); or int main(int argc, char **argv); or int main(void); or some other implementation-defined prototype; See also ``argc'' and ``argv''; the standard entry point to C programs


index1: #c
index2: malloc(0)
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: baltazar
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: baltazar!~baltazar@188-143-85-39.pool.digikabel.hu
type: text
action:
  /say malloc(0) is implementation-defined. It could return either a null pointer or a non-null pointer that shouldn't be dereferenced.


index1: #c
index2: mallocobj
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: nitrix
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nitrix!~nitrix@user/nitrix
type: text
action:
  /say It's better to use the object instead of the type as argument to sizeof when allocating.  int *p; p = malloc(sizeof *p); is preferable to p = malloc(sizeof (int)); because you can then later change p to long *p or some other type without having to worry about maintaining or forgetting to change the malloc.


index1: #c
index2: mallocsizeof
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pyzozord!~pyzozord@user/pyzozord
type: text
action:
  /say T *p = malloc(sizeof *p) is more robust than T *p = malloc(sizeof (T)) because sizeof *p will always be the correct size of T and it prevents unnecessarily repeating the T (DRY principle). If sizeof (T) is used and later one of the T's is changed there will be a mismatch. T *p = malloc(sizeof *p) is more concise and easier to read, especially when T is a compound type.


index1: #c
index2: man-pages-posix
last_referenced_in: prev
owner: prev!~prev@unaffiliated/prev
ref_user: prev!~prev@unaffiliated/prev
type: text
action:
  If you are using OS that tries to be POSIX-compliant, or if such OS is target platform, use POSIX manpages: `emerge man-pages-posix` in Gentoo; `apt-get install manpages-posix manpages-posix-dev` in Debian or Ubuntu; in Windows download man-pages-posix from https://tinyurl.com/man-pages-posix or download the POSIX from http://pubs.opengroup.org/onlinepubs/9699919799/download/


index1: #c
index2: manuals
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
type: text
action:
  /say Manuals document the implementation-specific behaviors and properties that are associated with a given implementation. For learning C, it is instead recommended to consult with a C book or the C standard.


index1: #c
index2: mb_cur_max
last_referenced_in: rob``
owner: twkm
ref_user: rob``
type: text
action:
  #include <limits.h> - maximum number of bytes in a mult-byte character for an extended character in the current locale, which is never greater than MB_LEN_MAX.


index1: #c
index2: mb_len_max
owner: defrost
ref_user: nobody
type: text
action:
  #include <limits.h> - maximum number of characters that constitute a multibyte character in any supported locale. Its value is >= MB_CUR_MAX.


index1: #c
index2: meaninglessinitializers
edited_by: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say Meaningless initializers are default initial values that act as a safety measure to avoid accessing uninitialized objects. This 'safety measure' doesn't fix your program and it severely reduces the capability to diagnose bugs. http://www.iso-9899.info/wiki/Meaningless_Initializers


index1: #c
index2: memory
last_referenced_in: ##c
owner: boru!~boru@unaffiliated/boru
ref_user: aozt!~aozt@unaffiliated/aozt
type: text
action:
  /say The structure of computer memory and how it is utilised is something with which all programmers should be familiar. See Drepper's paper: What Every Programmer Should Know About Memory: http://www.akkadia.org/drepper/cpumemory.pdf


index1: #c
index2: mingw-printf
edited_by: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
last_referenced_in: #c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: NRK!~nrkmatrix@2001:470:69fc:105::4e30
type: text
action:
  /say When using MinGW-w64 You should specify -D__USE_MINGW_ANSI_STDIO=1 for having a C99 compliant printf.


index1: #c
index2: modernc
edited_by: fz!~fz@user/fz
last_referenced_in: #c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say 'Modern C' by Jens Gustedt (2017) is a free book that teaches C11. https://hal.inria.fr/hal-02383654/file/ModernC.pdf


index1: #c
index2: nacq
last_referenced_in: aozt
owner: pragma_
ref_user: aozt!~aozt@unaffiliated/aozt
type: text
action:
  /say Not a C question. Your question is not specific to the C programming language. Standard C does not know nor care about colors, mice, windows, keyboards, networks or any other system-specific things. Please tell us what OS, compiler, tools or libraries you are using/abusing; or find the appropriate channel.


index1: #c
index2: nelemof
owner: prec
ref_user: n00p
type: text
action:
  a standard idiom for computing the number of elements in an array variable:  #define nelemof(array) (sizeof array/sizeof *array)


index1: #c
index2: newline
last_referenced_in: ##c
owner: edk!~edk@spy/edk0
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say \n represents an implementation-defined character value, which is translated to and from the system end-of-line character sequence when written to or read from a stream in text mode.


index1: #c
index2: notc
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c
owner: n00p
ref_user: constxd!~constxd@user/constxd
type: text
action:
  /say That is not a C issue.  This channel exists for discussion of the Standard C Language itself; not tools such as Makefiles, IDEs, compilers (see ##workingset for these things) or random libraries (including OS-specific ones such as POSIX or Windows; see ##posix or #winapi).


index1: #c
index2: null
edited_by: Maxdamantus!~Maxdamant@2001:470:f078::dead:beef:cafe
last_referenced_in: #c-jeopardy
owner: Major-Willard
ref_user: Sebravor!~androirc@pa49-197-220-12.pa.qld.optusnet.com.au
type: text
action:
  an (implementation-defined) macro expanding to a null pointer constant, which is any zero-value integer constant expression, possibly cast to void *. Such an expression has a special meaning in the context of pointer expressions to, for example, produce null pointers or test if other pointers are null pointers.


index1: #c
index2: nullp
edited_by: edk!~edk@spy/edk0
last_referenced_in: e
owner: edk!~edk@spy/edk0
ref_user: e!e@enucs/spy.edk
type: text
action:
  /say Null pointers are pointer values that are guaranteed to compare equal to 0 and to other null pointers, and not to point at any object or function.


index1: #c
index2: object
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: kate
owner: Wulf_
ref_user: kate!~kate@user/kate
type: text
action:
  /say An object is a region of data storage in the execution environment, the contents of which can represent values.


index1: #c
index2: octet
edited_by: dho!~dho@veep.9vx.org
last_referenced_in: autopsy
owner: FUZxxl!~fuz@d00m.org
ref_user: autopsy!~autopsy@fedora/autopsy
type: text
action:
  An octet is a value represented by eight bits. It is not synonymous with a byte, but is the minimum width of a byte value as defined by the C standard. Other useful factoids: ,byte; ,char; ,char_bit.


index1: #c
index2: offtopic
edited_by: e!e@enucs/spy.edk
last_referenced_in: #c
owner: atk!~Arch-TK@fsf/member/Arch-TK
ref_user: gl!~x@pwn.lu
type: text
action:
  /say For discussion not related to standard C, please go to ##c-offtopic. This includes, but is not limited to, discussion about non-standard libraries, operating systems, cats, video games, cars, chess, etc.


index1: #c
index2: oneliner
edited_by: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
last_referenced_in: nrk
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: NRK!NRK@orange.bnc4free.com
type: text
action:
  /say Code snippets that consist of a one-liner often lack context. It's better to post a code sample (to a paste site) that illustrates your question. It should be minimal and compilable.


index1: #c
index2: onlinek&r2
edited_by: fstd!~fstd@unaffiliated/fisted
last_referenced_in: #cjeopardy
owner: LordOllie
ref_user: fstd!~fstd@unaffiliated/fisted
type: text
action:
  /say If you cannot/will not buy k&r2 go here at least, then quit pissing and moaning. http://publications.gbdirect.co.uk/c_book/


index1: #c
index2: ooc
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Object-Oriented Programming With C: http://www.cs.rit.edu/~ats/books/ooc.pdf and https://www.state-machine.com/doc/AN_OOP_in_C.pdf


index1: #c
index2: opaque
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: dho!~dho@veep.9vx.org
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say An opaque type is a type whose contents are hidden. This is commonly used to require access and modifications to compound types to occur through an API. FILE * is an example of an opaque type in the standard library.


index1: #c
index2: p2s
last_referenced_in: #pbot2
owner: n00p
ref_user: \[!~qwename@unaffiliated/qwename
type: text
action:
  /say A pointer to a string is a pointer to its initial (lowest addressed) character. The length of a string is the number of bytes preceding the null character and the value of a string is the sequence of the values of the contained characters, in order.


index1: #c
index2: passingarrays
edited_by: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@109-186-215-86.bb.netvision.net.il
type: text
action:
  /say When an object with an array type is passed to a function it's being converted to a pointer to the first element of the array type. Given int arr[3]; the function call: func(arr); is the same as: func(&arr[0]); See http://www.iso-9899.info/wiki/Passing_Arrays


index1: #c
index2: paste-lite
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say Please paste a code sample that illustrates your question. It should be minimal and compilable.


index1: #c
index2: perseverance
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: nobody
type: text
action:
  /say In the realm of ideas everything depends on enthusiasm... in the real world all rests on perseverance.


index1: #c
index2: pjp
owner: d3738!05644814@gateway/web/freenode/ip.5.100.72.20
ref_user: nobody
type: text
action:
  /say The Standard C Library by P.J. Plauger. Prentice Hall, 1991. Shows you how to use the ANSI and ISO standard library functions. Also explains how the library was meant to be used. Can be purchased: https://www.abebooks.com/Standard-Library-P.J-Plauger-Prentice-Hall/11788721199/bd


index1: #c
index2: pointerops
last_referenced_in: ##c
owner: pragma_
ref_user: kate!~kate@unaffiliated/kate
type: text
action:
  /say The * operator makes an object from a pointer value.  The & operator makes a pointer value from an object.


index1: #c
index2: pointertoarray
edited_by: dorp!~dorp@84.111.138.241
last_referenced_in: baltazar
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: baltazar!~baltazar@188-143-85-39.pool.digikabel.hu
type: text
action:
  /say A pointer to an array type can be useful for dynamically allocating contiguous arrays of arrays (multidimensional arrays). It shouldn't be confused with a pointer to pointer. Code snippet: int (*arr)[4] = malloc(2 * sizeof *arr); arr[1][3] = 123;


index1: #c
index2: posix
last_referenced_in: ##c
owner: edk!~edk@spy/edk0
ref_user: dmlloyd!~dmlloyd@redhat/jboss/dmlloyd
type: text
action:
  /say POSIX is the Portable Operating System Interface, <http://pubs.opengroup.org/onlinepubs/9699919799/>. ##posix exists; please consider taking your related questions there.


index1: #c
index2: preccomma
last_referenced_in: dave0
owner: prec
ref_user: dave0!~dave@168.215.dsl.syd.iprimus.net.au
type: text
action:
  the sequence operator.  It is also used to separate syntactic elements of: function arguments in a function call, declarators (in declarations of the same type), formal parameters in function declarations, enumeration elements, and initializers.


index1: #c
index2: precedence
last_referenced_in: #c
owner: sickle
ref_user: siw5ohs0!~aiw5ohs0@user/aiw5ohs0
type: text
action:
  the order the compiler uses to evaluate C expressions.  See http://softkorner.wordpress.com/2011/09/21/precedence-of-c-operators/ for a table of operator precedence and associativity


index1: #c
index2: printingerrors
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say For printing error messages based on enums, see the following snippets: http://www.iso-9899.info/wiki/Printing_Errors


index1: #c
index2: purpose
edited_by: nitrix!~nitrix@unaffiliated/nitrix
last_referenced_in: ##c
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: nitrix!~nitrix@unaffiliated/nitrix
type: text
action:
  /say The purpose of the standard is to provide an unambiguous and machine-independent definition of the language.


index1: #c
index2: qsort
last_referenced_in: bou
owner: twkm
ref_user: Bou!sid274843@user/bou
type: text
action:
  / qsort() sorts an array of data, #include <stdlib.h>, void qsort(void *base, size_t nelems, size_t elsize, int (*compar)(const void *, const void *)); returns nothing, see http://www.iso-9899.info/man?qsort


index1: #c
index2: quine
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: dave0
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  #include <stdio.h> char *s = "#include <stdio.h> char *s = %c%s%c, c = '%c'; int main(void) { printf(s,c,s,c,c); return 0; }", c='"'; int main(void) { printf(s,c,s,c,c); return 0; }


index1: #c
index2: rand
last_referenced_in: nitrix
owner: twkm
ref_user: nitrix!~nitrix@user/meow/nitrix
type: text
action:
  pseudo-random number generator, #include <stdlib.h>, int rand(void); returns the next number in the sequence in the range [0,RAND_MAX], see http://www.iso-9899.info/man?rand and http://www.azillionmonkeys.com/qed/random.html


index1: #c
index2: randomtesting
last_referenced_in: fizzie
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: fizzie!fis@unaffiliated/fizzie
type: text
action:
  /say Due to the nature of undefined/implementation-specific/unspecified behavior, testing random code is not a adequate way of determining if something really does work.


index1: #c
index2: referencedtype
owner: pragma_
ref_user: lemonade`
type: text
action:
  "a pointer type may be derived from a function type, an object type, or an incomplete type, called the referenced type.  A pointer type describes an object whose value provides a reference to an entity of the referenced type.  A pointer type derived from the referenced type T is sometimes called ``pointer to T''.  The construction of a pointer type from a referenced type is called ``pointer type derivation''."


index1: #c
index2: references
last_referenced_in: ##c-offtopic
owner: pragma_
ref_user: esselfe!~bsfc@unaffiliated/esselfe
type: text
action:
  /say C does not have pass-by-reference or "heavy" references like C++ or some other languages do.  C does have a definition of references that is probably not what you want or need to know about, see:  referencedtype


index1: #c
index2: register
last_referenced_in: #c
owner: pragma_
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  a storage-class specifier for an object that suggests that access for the object be as fast as possible.  The extent to which the suggestion is effective is implementation defined.  Whether or not addressable storage is actually used, the address of any part of an object declared with storage-class specifier register cannot be computed.


index1: #c
index2: registers
last_referenced_in: stark
owner: boris``
ref_user: stark!stark@unaffiliated/stark
type: text
action:
  /say If you have a question about accessing registers in C, please don't ask us. Standard C has no way of manipulating hardware registers. We don't know what compiler or platform you're using. You should be reading the documentation instead.


index1: #c
index2: resources
last_referenced_in: ##c
owner: pragma_
ref_user: muffindrake!~muffindra@unaffiliated/muffindrake
type: text
action:
  http://www.lysator.liu.se/c/ - http://www.iso-9899.info/wiki/Web_resources - http://www.iso-9899.info/wiki/Books - See also: reference


index1: #c
index2: restrict
last_referenced_in: masoudd
owner: twkm
ref_user: masoudd!~masoudd@user/masoudd
type: text
action:
  a type qualifier, which may only be used with a pointer type, and which requires that objects referenced through such a pointer must be made through a single pointer value, i.e., no aliases / pointers into other parts of the object are allowed


index1: #c
index2: retrun
owner: k!~krok@unaffiliated/krok
ref_user: nobody
type: text
action:
  /say `retrun` is a common typo of `return`. Use `#define retrun return` to rectify the problem for good.


index1: #c
index2: rsize_t
last_referenced_in: ##c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  /say The type rsize_t is equivalent to the type size_t but with a runtime-constraint violation if the value is greater than RSIZE_MAX.


index1: #c
index2: rtfb
last_referenced_in: protege
owner: PoppaVic
ref_user: protege!~shynoob@182.59.209.11
type: text
action:
  /say Read the @#&ing Book - Your primary guide for learning C should be a good book (see http://www.iso-9899.info/wiki/Books).  You must not expect to become a proficient C programmer just from reading crappy online `tuts', staring at other people's code, and/or boring us to death by asking dozens of exceedingly trivial questions.


index1: #c
index2: rules
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: oldlaptop!~quassel@45.63.78.126
ref_user: dorp!~dorp@85-250-41-117.bb.netvision.net.il
type: text
action:
  /say There are 3 simple rules for learning C effectively and successfully: 1. Follow a proper book, 2. Do the exercises, 3. Share your code samples with others and ask for comments/review.


index1: #c
index2: sauce
edited_by: edk!edk@unaffiliated/edk
last_referenced_in: ##c-offtopic
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: clumsy_boy!~leoni@181.26.8.127
type: text
action:
  /say I wrote a program in C that suggests recipes. One of them is a lasagne sauce. Should I make it sweet or spicy? It's written in C. Please.


index1: #c
index2: scanf
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c-jeopardy
owner: Major-Willard
ref_user: Guenevere!~Anhedonia@2001:8004:1140:3639:99d1:d4b7:b383:9ea9
type: text
action:
  a function that can be unsafe and unproductive - "It's nearly impossible to do decent error recovery with scanf; usually it's far easier to read entire lines (with fgets or the like), then interpret them, either using sscanf or some other techniques." - See http://www.eskimo.com/~scs/C-faq/q12.20.html


index1: #c
index2: scanf_is_stupid
last_referenced_in: ##c
owner: n00p
ref_user: kate!~kate@unaffiliated/kate
type: text
action:
  /say It looks like the !scanf factoid was unsuccessful at convincing you not to use scanf(). scanf() isn't really that stupid, providing you know how to use it correctly. Chris Torek explains some problems with the way scanf() is commonly used and provides methods of solving those problems here: http://bytes.com/topic/c/answers/215517-warning-against-scanf#post840862


index1: #c
index2: schildt
last_referenced_in: #tendra
owner: pragma_
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Please avoid Herbert Schildt's C books.  See http://www.seebs.net/c/c_tcn4e.html and http://www.lysator.liu.se/c/schildt.html -- Other stuff to avoid: http://www.iso-9899.info/wiki/Main_Page#Stuff_that_should_be_avoided


index1: #c
index2: sequencepoint
last_referenced_in: #c
owner: Wulf_
ref_user: fz!~fz@user/fz
type: text
action:
  /say Evaluation of an expression may produce side effects. At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place.


index1: #c
index2: serialize
last_referenced_in: ##c
owner: PoppaVic
ref_user: marchelzo!~marchelzo@unaffiliated/marchelzo
type: text
action:
  packing structures, usually portably for later extraction: see man 3 xdr as well as http://tpl.sourceforge.net/ and http://www.leonerd.org.uk/code/libpack/


index1: #c
index2: short
last_referenced_in: masoudd
owner: infobahn
ref_user: masoudd!~masoudd@user/masoudd
type: text
action:
  a signed integer data type, at least 16 bits wide, which must be able to represent (at least) all the numbers in the range -32767 to +32767. Its lowest value, SHRT_MIN, and highest value, SHRT_MAX, are defined in <limits.h>


index1: #c
index2: shuffle
last_referenced_in: ##c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: BenGoldberg!~BenGoldbe@ool-18bca78c.dyn.optonline.net
type: text
action:
  /say { srand(time(0));    int array[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, end = 10;  while(end > 0) { int random = rand() % end; end--; int temp = array[end]; array[end] = array[random]; array[random] = temp; }    for(int i = 0; i < 10; i++) printf("%d ", array[i]); }


index1: #c
index2: simplifying
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: jp!ayy@youlosethega.me
ref_user: jp!ayy@youlosethega.me
type: text
action:
  /say Simplifying is something that should be /simple/. If it isn't then your code is needlessly complex; it often would actually be faster to remake that particular section from scratch.


index1: #c
index2: sing
last_referenced_in: #c-offtopic
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: esselfe!~steph@user/esselfe
type: text
action:
  /me sings: "Soft kitty, warm kitty, little ball of fur~ Happy kitty! Sleepy kitty! Purr, purr, purr~"


index1: #c
index2: sir
last_referenced_in: ##c
owner: nitrix
ref_user: blue403!~smurfa@unaffiliated/smurfa
type: text
action:
  /say All I ask is that you be a sir. Fancy mustaches, top hats, and monocles are scientifically proven to impress the ladies.


index1: #c
index2: size_t
last_referenced_in: #c
owner: prec
ref_user: masoudd!~masoudd@user/masoudd
type: text
action:
  an unsigned integer type which is the result type of the sizeof operator.  A size_t variable can store the size of any object.  C90: printf("%lu\n", (unsigned long)sizeof a); C99: printf("%zu\n", sizeof a);


index1: #c
index2: sizeof
action_with_args: /call cc sizeof $args
edited_by: edk!~edk@spy/edk0
last_referenced_in: #c
owner: prec
ref_user: siw5ohs0!~aiw5ohs0@user/aiw5ohs0
type: text
action:
  /say The sizeof operator yields a size_t, that is the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type. e.g. `sizeof expr` and `sizeof (int)`. That expression is not evaluated unless it is a variable-length array. sizeof does not have function call semantics; don't confuse people by writing it with function call syntax.


index1: #c
index2: smartq
edited_by: boru!~boru@unaffiliated/boru
last_referenced_in: ##c
owner: boru!~boru@unaffiliated/boru
ref_user: edk!~edk@spy/edk0
type: text
action:
  /say Learning how to effectively ask questions is beneficial for all. See http://www.catb.org/esr/faqs/smart-questions.html or https://tools.ietf.org/html/rfc1855


index1: #c
index2: spiral
last_referenced_in: #c
owner: Draconx|Laptop
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  The "Clockwise/Spiral Rule" is a technique for understanding C declarations.  See http://c-faq.com/decl/spiral.anderson.html


index1: #c
index2: sscanf
last_referenced_in: gnoo
owner: pragma_
ref_user: gnoo!gnoo@user/gnoo
type: text
action:
  /say The sscanf function is similar to scanf, except that its input comes from a string instead of a stream. fgets is commonly used prior to sscanf to provide a simple approach which doesn't leave unmatched bytes on the stream, unlike scanf. Note that sscanf's and sprintf's format specifiers are not perfectly reflective, and that it is possible for fgets to fetch part of a line.


index1: #c
index2: ssize_t
edited_by: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
ref_user: dorp!~dorp@93-172-96-162.bb.netvision.net.il
type: text
action:
  /say The ssize_t type is not a C standard type, it is part of POSIX. Its required range is [-1, 32767] and it's described as: "Used for a count of bytes or an error indication"


index1: #c
index2: standard
edited_by: edk!~edk@spy/edk0
last_referenced_in: #c
owner: kate`
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  C89/C90 draft: http://port70.net/~nsz/c/c89/c89-draft.html - C99 + TC1,2,3 working paper: http://open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf - C11 draft: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf - Quick C library reference: http://goo.gl/n3TYMD  - An explanation of all C standards: http://clc-wiki.net/wiki/The_C_Standard


index1: #c
index2: static
last_referenced_in: #c
owner: Major-Willard
ref_user: siw5ohs0!~aiw5ohs0@user/aiw5ohs0
type: text
action:
  used if the function/variable should be limited to one source file, at translation unit scope; variables of this storage class are initialised to zero; variables of this storage class which are declared in functions maintain their value between calls to the function


index1: #c
index2: stdarg
last_referenced_in: dave0
owner: prec
ref_user: dave0!~dave@32.060.dsl.syd.iprimus.net.au
type: text
action:
  interfaces for handling variable argument lists; #include <stdarg.h>; void va_start(va_list ap, arg); void va_copy(va_list dest, va_list src); type va_arg(va_list ap, type); void va_end(va_list ap); see http://www.iso-9899.info/man?stdarg


index1: #c
index2: stdin
last_referenced_in: dorp
owner: Major-Willard
ref_user: dorp!~dorp@46.120.11.7
type: text
action:
  a FILE *, traditionally associated with file descriptor 0, using fflush() with it is generally pointless


index1: #c
index2: stdinflush
last_referenced_in: ##c
owner: pragma_
ref_user: cousteau!~cousteau@unaffiliated/cousteau
type: text
action:
  /say Will fflush(stdin) flush unread characters from the standard input stream?  No!  See http://www.c-faq.com/stdio/stdinflush.html and http://www.c-faq.com/stdio/stdinflush2.html


index1: #c
index2: string
last_referenced_in: nitrix
owner: kate`
ref_user: nitrix!~nitrix@user/nitrix
type: text
action:
  /say A "string" is a contiguous sequence of characters terminated by and including the first null character; http://www.iso-9899.info/wiki/String


index1: #c
index2: stringliteral
last_referenced_in: ##c
owner: dorp!~dorp@84.111.138.241
ref_user: dorp!~dorp@89-139-210-198.bb.netvision.net.il
type: text
action:
  /say The attempt to modify a string literal has undefined behavior; an array may be initialized by a string literal, modifying such an array is well-defined. char arr[] = "string";


index1: #c
index2: stringptr
last_referenced_in: maxxe
owner: n00p
ref_user: maxxe!~maxxe@unaffiliated/maxxe
type: text
action:
  /say A pointer to a string is a pointer to its initial (lowest addressed) character. See also: !string


index1: #c
index2: strncpy
last_referenced_in: #c
owner: pragma_
ref_user: humm!37efd3903b@user/humm
type: text
action:
  http://c-faq.com/lib/strncpy.html and http://blogs.msdn.com/oldnewthing/archive/2005/01/07/348437.aspx


index1: #c
index2: strtol
last_referenced_in: ##c
owner: fstd!~fstd@unaffiliated/fisted
ref_user: izabera!~izabera@unaffiliated/izabera
type: text
action:
  /say The strtol() function converts a string to a long int value in a way that allows the caller to do meaningful error handling.


index1: #c
index2: support
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: prec
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say If you are looking for support for a particular piece of software, you are in the wrong place.  This channel exists for C programmers and those aspiring to be C programmers -- it is not a general software support channel.


index1: #c
index2: ternary
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say ?: is called the conditional operator. Some people refer to it as the ternary operator. This is not its name. While it is currently the only operator in C that takes three operands, this may not always be the case. It's just a description of it, not its name. It's called the conditional operator.


index1: #c
index2: testing
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say C unit testing frameworks: https://check.sourceforge.net | https://github.com/Tuplanolla/cheat | https://cmocka.org/ | https://github.com/meekrosoft/fff


index1: #c
index2: therule
edited_by: edk!~edk@spy/edk0
last_referenced_in: ##c-offtopic
owner: ouah
ref_user: nh!NextHendri@unaffiliated/nexthendrix
type: text
action:
  /say The Rule, as Chris Torek calls it, is outdated, wrong and mostly useless. If you want to read it anyway, it says: "In a value context, an object of type "array N of T" (for suitable size N and element type T) becomes a value of  type "pointer to T", pointing to the first element of that array, i.e., the one with subscript 0." http://web.torek.net/torek/c/pa.html


index1: #c
index2: threads
edited_by: arcsin!~arcsin@user/arcsin
last_referenced_in: #c
owner: glacial!~glacial@unaffiliated/glacial
ref_user: arcsin!~arcsin@user/arcsin
type: text
action:
  /say http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf || POSIX Threads programming: http://web.archive.org/web/20170120023916/http://computing.llnl.gov/tutorials/pthreads/


index1: #c
index2: tias
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: ski
owner: Spark
ref_user: ski!~ski@remote11.chalmers.se
type: text
action:
  /say "Try It And See" may work in other languages, but not in C due to the nature of undefined behavior/unportable code. Such coding-by-experimentation often leads to situations such as "But it worked fine earlier!" and/or "But it worked on my machine!". https://web.archive.org/web/20230415080253/https://ramblings.implicit.net/c/2014/04/20/c-is-not-a-try-it-and-see-language.html


index1: #c
index2: tias-lite
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
type: text
action:
  /say "Try It And See" may work in other languages, but not in C due to the nature of undefined behavior/unportable code. https://goo.gl/jPWRA9


index1: #c
index2: top10
last_referenced_in: ##c-offtopic
owner: pragma_
ref_user: iamgarp!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say Top 10 beginner mistakes: http://www.andromeda.com/people/ddyer/topten.html (Bonus: find the mistakes within the mistakes!)


index1: #c
index2: trigraph
last_referenced_in: ##c-offtopic
owner: twkm
ref_user: RicardasSim!~RicardasS@78-63-172-44.static.zebra.lt
type: text
action:
  a three character sequence beginning with two question marks, intended to make using C possible on systems where the usual punctuators are missing, typically from keyboards. these sequence is replaced during phase 1 of translation and takes place even within quoted strings.


index1: #c
index2: tu
last_referenced_in: xatenev
owner: pragma-
ref_user: Xatenev!~xatenev@user/xatenev
type: text
action:
  /say A source file together with all the headers and source files included is known as a preprocessing translation unit . After preprocessing, a preprocessing translation unit is called a translation unit. The separate translation units of a program communicate by (for example) calls to functions whose identifiers have external linkage, manipulation of objects whose identifiers have external linkage, or manipulation of data files.


index1: #c
index2: tuts
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c
owner: Jafet
ref_user: Learath2!~learath2@unaffiliated/learath2
type: text
action:
  /say Almost every "tutorial" on the web is written by a person who does not know C well. Would you learn C from such a person? Obtain a good C book (see ,books) and read it.


index1: #c
index2: typedef
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say Typedefing all structs hinders code readability by forcing the reader to look up the typedef. Only typedef structs when they are supposed to be opaque types used via accessor/mutator functions; better yet, use an incomplete struct type. Never use typedef to create a pointer type.


index1: #c
index2: typedeffunction
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
type: text
action:
  /say You can typedef a function type which is not a pointer type. Snippet: http://www.iso-9899.info/wiki/Typedef_Function_Type


index1: #c
index2: types
last_referenced_in: retr0id
owner: PoppaVic
ref_user: Retr0id!~null@host86-177-223-109.range86-177.btcentralplus.com
type: text
action:
  http://www.ibm.com/developerworks/power/library/pa-ctypes3/ -- http://www.ibm.com/developerworks/views/power/libraryview.jsp?search_by=everything+you+ever+wanted+to+know+about+C+types


index1: #c
index2: uaf
last_referenced_in: #pbot2
owner: pentester_!~pentester@unaffiliated/pentester
ref_user: jp!ayy@youlosethega.me
type: text
action:
  /say Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.


index1: #c
index2: ub
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c
owner: pragma_
ref_user: Wulf!~Wulf@user/meow/Wulf
type: text
action:
  /say Undefined behavior is behavior for which the C standard does not impose any requirements.  This is to allow C the freedom to be implemented on systems with different architectures.  Programs invoking undefined behavior may appear to compile and even run without errors at first, only to fail on another system, or even at a later time.  If you want to write reliable code, don't use such behaviors.


index1: #c
index2: unsigned
last_referenced_in: nrk
owner: infobahn
ref_user: NRK!~nrk@2001:470:69fc:105::4e30
type: text
action:
  a qualifier for integer data types, which renders them incapable of representing negative numbers but increases the number of positive values they can represent.


index1: #c
index2: usb
last_referenced_in: #c-jeopardy
owner: pragma_
ref_user: sjohnson!sjohnson@cow.sj.rfc1459.net
type: text
action:
  /say Unspecified behavior is behavior for which the C standard provides two or more possibilities, and imposes no further requirements on which behavior is chosen in any instance.  Not to be confused with undefined behavior or implementation dependent behavior.


index1: #c
index2: valgrind
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@bzq-84-111-138-241.cablep.bezeqint.net
type: text
action:
  /say Valgrind can detect many memory management and threading bugs under Linux or OS X (no Windows support). http://valgrind.org/


index1: #c
index2: vla
edited_by: marchelzo!~marchelzo@unaffiliated/marchelzo
last_referenced_in: #c
owner: Wulf_
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  a variable length array: an array data structure of automatic storage duration whose length is determined at run time (instead of at compile time). Example: void foo(int n) { float arr[n]; }


index1: #c
index2: volatile
edited_by: nitrix!~nitrix@unaffiliated/nitrix
last_referenced_in: bartmon
owner: nitrix!~nitrix@unaffiliated/nitrix
ref_user: bartmon!~bartmon@89-212-95-222.link.t-2.net
type: text
action:
  /say A volatile-qualified object may be modified in ways unknown to the implementation or have other unknown side effects when accessed. Actions on such objects shall not be `optimized out` by an implementation or reordered except as permitted by the rules for evaluating expressions.


index1: #c
index2: wcsftime
last_referenced_in: sacho
owner: twkm
ref_user: sacho!~hecatonic@176-12-62-113.pon.spectrumnet.bg
type: text
action:
  convert date and time to wide string, #include <wchar.h>, size_t wcsftime(wchar_t *ws, size_t maxlen, const wchar_t *format, const struct tm *timeptr); returns NULL if the conversion would succeed within maxlen wide characters otherwise the number of codes stored excluding the terminating null wide character, see http://www.iso-9899.info/man?wcsftime


index1: #c
index2: wcsrtombs
last_referenced_in: ##c
owner: twkm
ref_user: fluter!~fluter@fedora/fluter
type: text
action:
  convert wide character string to (narrow) character string (restartable), #include <wchar.h>, size_t wcsrtombs(char *s, const wchar_t **ws, size_t len, mbstate_t *ps); returns (size_t)-1 and stores EILSEQ in errno if a wide character is encountered that cannot be converted otherwise the number of bytes in the resulting sequence not including the terminating null character, see http://www.iso-9899.info/man?wcsrtombs


index1: #c
index2: webdiagnostics
last_referenced_in: ##c
owner: dorp!~dorp@bzq-84-111-138-241.red.bezeqint.net
ref_user: dorp!~dorp@93-172-96-162.bb.netvision.net.il
type: text
action:
  /say You shouldn't rely on the diagnostics (errors/warnings) capabilities of web compilers. See diagnostics


index1: #c
index2: worksforme
last_referenced_in: xatenev
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: Xatenev!~xatenev@user/xatenev
type: text
action:
  /say It works. I tested it, it works.  (2 days later...)  Shit, it doesn't work on my professor's machine, why?


index1: #c
index2: xz
last_referenced_in: cousteau
owner: atk!~Arch-TK@fsf/member/Arch-TK
ref_user: cousteau!~cousteau@unaffiliated/cousteau
type: text
action:
  /say The XZ problem: You want to type XY but you forgot that you are typing on an unusual keyboard where the Z and Y keys are swapped for some reason.


index1: #c
index2: yru
last_referenced_in: ##c
owner: mzo!~marchelzo@unaffiliated/marchelzo
ref_user: mzo!~marchelzo@unaffiliated/marchelzo
type: text
action:
  y, r, and u are very convenient shorthands for why, are, and you. their use in this channel is highly encouraged.


index1: #c
index2: |=
last_referenced_in: pragma-
owner: prec
ref_user: pragma-
type: text
action:
  the bitwise inclusive-OR assignment operator.  The expression (x |= y) is equivalent to (x = x | y) except that the expression x is evaluated only once.


index1: #c-offtopic
index2: 9000%
last_referenced_in: #c-offtopic
owner: lambda443!~lmb@188.48.124.241
ref_user: siw5ohs0!~aiw5ohs0@user/aiw5ohs0
type: text
action:
  the maximum possible ratio in gogenhiemian arithmetic, (the % symbol is not to be confused with the inheimusist usage of it) (See Also: heimus, gogenheimian-arithmetic, gogenheima)


index1: #c-offtopic
index2: age-of-enlightenment
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: #c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  Googenheimese: The period of peace and stability following the coming of Heimus and the Battle of Idj. Ended with the The Great Tarding.


index1: #c-offtopic
index2: anti-heimus
last_referenced_in: #c-offtopic
owner: lambda443!~lmb@188.48.124.241
ref_user: Bou!sid274843@user/bou
type: text
action:
  A man who comes at the end of time after the 92nd return of heimus, according to scripture: "the fools confuse him for Me and follow him, damned they are and death is what they recieve", only true believers who follow heimus's teachings by heart avoid him. (See Also: heimus, heimuism, gargarian, gargorio)


index1: #c-offtopic
index2: apic
edited_by: oldlaptop!~quassel@45.63.78.126
last_referenced_in: #c-offtopic
owner: oldlaptop!~quassel@45.63.78.126
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /code tcl set _s [join $argv]\n set _i 0\n proc rcap {_s _f _l} { if {rand() < 0.5} { return [string toupper $_s $_f $_l]}\n return $_s}\n set _s [rcap $_s 0 0]\n while {[regexp -indices -start $_i {[[:space:]]([a-z])} $_s -> _r]} { set _s [rcap $_s {*}$_r]\n set _i [lindex $_r 0]}\n puts $_s


index1: #c-offtopic
index2: apichs
edited_by: nil!~n@monade.li
last_referenced_in: ##c-offtopic
owner: nil!~n@monade.li
ref_user: nil!~n@monade.li
type: text
action:
  /call cc -lang=haskell import Data.Char\nimport System.Random\np = 0.45\nmain = getContents >>= fmap unwords . mapM (\(c:cs) -> do n <- randomIO :: IO Double; return $ (if n < p then toUpper c else c):cs) . words >>= putStrLn -stdin


index1: #c-offtopic
index2: babble
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: #pbot2
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: jp!ayy@youlosethega.me
type: text
action:
  Googenheimese: The Holy Book of the zerosturugi religion of Googenheim, Heimusism, which tells the tales of Heimus and his battles against tardery.


index1: #c-offtopic
index2: battle-of-idj
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
type: text
action:
  The battle between Heimus and the Dumigod Sojiwar. Both are reputed to have fallen in battle, but no reliable account is available as everyone within the distance of existence immediately became retarded. A national holiday in Googenheim, which follows Gasdugapoo on the 29th of every month except February.


index1: #c-offtopic
index2: battle-of-nabla
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  Googenheimese: the first battle of the Heimusism age, it occurred in 32 A.H. where everyone didn't feel like fighting but died anyway. The name is derived from one soldier's account of asking his squad leader "Should we charge?" to which he replied "Nah, blah." before they were all run down and killed by Heimus and The Chosen Ones.


index1: #c-offtopic
index2: bin2ascii
last_referenced_in: esselfe
owner: nil!~n@monade.li
ref_user: esselfe!~steph@user/esselfe
type: text
action:
  /call python from sys import argv; print('' .join(chr(int(argv[1][i*8:(i+1)*8], 2)) for i in range(len(argv[1])//8))) -args


index1: #c-offtopic
index2: bk_ingredient
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "Royale with Cheese™" "$whopper_type WHOPPER™" "$whopper_type WHOPPER™ Jr." hamburger cheeseburger "double cheeseburger" "bacon cheeseburger" "bacon double cheeseburger" "$chicken_type:ucfirst Chicken™ sandwich" "$chicken_type:ucfirst Chicken Caesar™ sandwich" "Original Chicken™ sandwich" "Crispy Chicken™ sandwich" "Big Fish™ sandwich" "Chicken Jr.™" "$chicken_type:ucfirst Chicken Jr.™"


index1: #c-offtopic
index2: bk_make_drink
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "a $soda_container of $soda_ingredient $soda_word" "a $milkshake_container of $milkshake_ingredient milkshake $milkshake_extras"


index1: #c-offtopic
index2: bk_side_dishes
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "a $sizes fry" "$sizes fries" "$sizes chicken nuggets" "$nugget_count $pie_meats nuggets" "$sizes onion rings" "$sizes hash browns" "Chicken Fries" "Crispy Taco" "CHEESY TOTS" "Mozzarella Sticks" "Garden Side Salad" "a plastic toy $rpg_thing"


index1: #c-offtopic
index2: braincapacity
last_referenced_in: ##c-offtopic
owner: lambda443!~lambda443@unaffiliated/lambda443
ref_user: oldlaptop!~quassel@45.63.78.126
type: text
action:
  /code python3 import sys\nimport statistics\nword = sys.argv[1]\nPI=3.14\ndata= [ ord(i) for i in word.lower() ]\nprint ( '{:.2f} %'.format( (statistics.mean(data)+PI/statistics.stdev(data)*100 )%100) )


index1: #c-offtopic
index2: brainpower
edited_by: lambda443!~lambda443@unaffiliated/lambda443
last_referenced_in: ##c-offtopic
owner: lambda443!~lambda443@unaffiliated/lambda443
ref_user: jp!ayy@youlosethega.me
type: text
action:
  /code python3 import sys\nimport statistics\nvar1=1977.91\nvar2=39.13\nword=sys.argv[1] if (len(sys.argv[1])>1) else sys.argv[1]+'fk'\ndata= [ ord(i) for i in word.lower() ]\nprint ( '{:.2f} %'.format( (((statistics.mean(data)*var1) / (statistics.stdev(data)+var2)) *40) %99 ) )


index1: #c-offtopic
index2: common-tongue
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  Googenheimese: the language spoken by the people of several countries in Tardscape prior to "The Great Tarding" (See also: the-great-tarding, tardscape)


index1: #c-offtopic
index2: cthulhusim
last_referenced_in: ##c-offtopic
owner: oldlaptop!~quassel@45.63.78.126
ref_user: nil!~n@monade.li
type: text
action:
  /call cc int s,h=0,c=0,n=0,x[2]={2,2},y[2]={0};char*k[3]={"ASDFG HLKJ","QWERTPOIUY"," ZXCVBOUMN"};srand(time(0));s=rand()&1<<5;do{for(int i=0;i<2;i++){x[i]=abs((x[i]+(rand()%4?1:rand()%32?rand()%2-2:0))%5);y[i]=(rand()%10>7)?0:(rand()%4?y[i]:y[i]?0:rand()%3);}h^=!(rand()%3);c=k[y[h]][x[h]+h*5]^s;if((c|32)=='a'&&!(rand()%3))s^=32;if(c<32)c|=32;putchar(c);}while(++n<32||rand()%24);


index1: #c-offtopic
index2: dreams
edited_by: k!~krok@unaffiliated/krok
last_referenced_in: ##spinach
owner: dansan!~daniel@2600:1700:be30:d00::49
ref_user: Ranhir!~Ranhir@157.97.53.139
type: text
action:
  /say Dreams are the subconscious mind's way of reminding people to go to school naked and have their teeth fall out.


index1: #c-offtopic
index2: e_dislike
edited_by: nf!~n@monade.li
last_referenced_in: siw5ohs0
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: siw5ohs0!~aiw5ohs0@user/aiw5ohs0
type: text
action:
  "i hate" "i dislike" "i detest" "i don't care for" "there's no merit to" "i'm not too keen on" "i'm not a $sizes fan of" "i can't say i'm too interested in" "the worst thing in this $rpg_location2 is" "can we not have" fuck "imagine liking" "i don't think there are any redeeming qualities to" "i am indifferent to"


index1: #c-offtopic
index2: facism
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  Googenheimese: Anyone who says something one doesn't agree with while having a face. (See also: scolflak)


index1: #c-offtopic
index2: factornh
edited_by: christopher!NextHendri@unaffiliated/nexthendrix
last_referenced_in: ##c-offtopic
owner: christopher!NextHendri@unaffiliated/nexthendrix
ref_user: nh!~NextHendr@unaffiliated/nexthendrix
type: text
usage: Usage: factornh <integral value>
action:
  /code python3
  import math, sys
  def factor(n):
      if n < 2:
          return [420, 69,"nil is gay"]
      div = 3
      fs = []
      while not n%2:
          fs.append(2)
          n = n // 2
      while n > 1:
          if not n % div:
              fs.append(div)
              n = n // div
          else:
              div += 2
      return fs
  print(factor(int(sys.argv[1])))


index1: #c-offtopic
index2: fctr
edited_by: zalt!~lambda443@unaffiliated/lambda443
last_referenced_in: ##c-offtopic
owner: zalt!~lambda443@unaffiliated/lambda443
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /code python3
  import math, sys
  def fctr(n):
      d = int(math.sqrt(n)) + 1
      for i in range(2, d):
          if n % i == 0:
              return (i, n // i)
      return 'prime'
  print(fctr(int(sys.argv[1])))


index1: #c-offtopic
index2: foremostu
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  Googenheimese: 1) something that comes prior to secondmostu, but after zerosturugi 2) a female name 3) a phrase yelled by gophers


index1: #c-offtopic
index2: gargarian
edited_by: lambda443!~lmb@188.48.124.241
last_referenced_in: ##c-offtopic
owner: lambda443!~lmb@188.48.124.241
ref_user: lambda443!~lmb@188.48.124.241
type: text
action:
  a word in Googenheimese, 1: people without culture or education, they often eat their dead's feces. 2: people who don't believe in Heimus's teachings. (See Also: gargorio, heimus)


index1: #c-offtopic
index2: gargorio
edited_by: lambda443!~lmb@188.48.124.241
last_referenced_in: #pbot2
owner: lambda443!~lmb@188.48.124.241
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  A philosopher who lived in the 700s B.H. the only known idea by him is that "Knowledge is artificial, man has to unlearn everything in order to truly become an animal", the rest of his ideas are unknown because he unlearned them, it is said that he ate himself to death. "gargarians" are named for him (See also: gargarian, penovia, BH)


index1: #c-offtopic
index2: garpify
edited_by: oldlaptop!~quassel@45.63.78.126
last_referenced_in: #wordle
owner: oldlaptop!~quassel@45.63.78.126
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /code tcl proc putc {_s} {puts -nonewline $_s}\n proc putr {} {putc [binary format c [expr int(rand() * 26 + 65)]]}\n set _l [string length $argv]\n set _cpt [expr $_l >= 12 ? 7 : $_l - ($_l / 8)]\n set _cpi [expr $_l >= 12 ? 12 : $_l + $_l * (1 - 7.0/12)]\n foreach _c [split [join $argv] "" ] { if {![string is space $_c] && rand() < (1.0/$_cpt)} putr else {putc [string toupper $_c]}\n if {rand() < (1.0/$_cpi)} putr}


index1: #c-offtopic
index2: gasdugapoo
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: bou
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: Bou!sid274843@user/bou
type: text
action:
  Googenheimese: The rape festival in Googenheim  (which follows the reap festival which nobody really cares much about), a daily festival.


index1: #c-offtopic
index2: gogenheimian-arithmetic
last_referenced_in: #c-offtopic
owner: lambda443!~lmb@188.48.124.241
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  the branch of knowledge that was the foundation of all inheimusist science and technology, it introuduced the modern day operators [ + | - | * | / ], it uses base 9000 for all ratios, but no real number can be more than 2, because of the belif that all things are one, eg. (1+1= 1.5, 1+2=1.66, 1+3=1.75) (See Also: heimus, 9000%, gogenheiam)


index1: #c-offtopic
index2: googenheim-info
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  The Kingdom of Googenheim, land of people with mental faculties that understand nuance. The national animal is a donkey. National bird is a pterodactyl. The flag is a palm applied to a face, with an Ekto-Kooler-green background.


index1: #c-offtopic
index2: heimus
edited_by: lambda443!~lmb@188.48.124.241
last_referenced_in: #c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  1) The founder of heimusism: Heimus of Kanivro, the man who brought the masses out of darkness and into the light, he first gathered people of kanivro near its Highest mountain and brought with him all of their false idols, he threw them one by one from its highest point while kanivro's wise were yelling at him, Truncated: See Heimus-2


index1: #c-offtopic
index2: heimus-2
last_referenced_in: #c-offtopic
owner: lambda443!~lmb@188.48.124.241
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  he threw 5000 thousand idols and all of them collapsed except 6 of them, proving by experiement that they are the only true ones, some inheimusist skeptics noted that they were made of bronze while the rest were of stone and mortar  2) (slang, offensive) vagina.  (See Also: heimus, heimusism, battle-of-idj, xinophro, anti-heimus)


index1: #c-offtopic
index2: heimusism
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: lambda443!~lmb@188.48.124.241
type: text
action:
  Googenheimese: The zerosturugi religion of Googenheim which worships Heimus and his 93rd coming. 97.6% of Googenheimers are Heimusians (See also: babble, battle-of-idj, Sojiwar)


index1: #c-offtopic
index2: hex2ascii
last_referenced_in: ##c-offtopic
owner: nil!~n@monade.li
ref_user: esselfe!~bsfc@unaffiliated/esselfe
type: text
action:
  /call python from sys import argv; print('' .join(chr(int(argv[1][i*2:(i+1)*2], 16)) for i in range(len(argv[1])//2))) -args


index1: #c-offtopic
index2: incompeton
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  Googenheimese: 1) visiting Compton 2) dumb 3) (slang) being in a neighborhood where the likelihood of mugging exceeds 74%


index1: #c-offtopic
index2: j2
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: alyptik!ayy@youlosethega.me
ref_user: jp!~root@user/alyptik
type: text
action:
  /code perl print "/say ";   print  join " ",map{s/l/r/gri}map{s/th(?=[\Q !,.?\E])/thuru/gr}map{s/(?<=[aeiou])s(?=[\Q!,.?\E])/tsu/gr}map{s/g?(h+)(?=[\Q!,.?\E])/$1uro/gr}map{s/l+(?=[ \Q!,.?\E])/rru/gr}map{s/l(?=[^ \Q!,.?\E])/r/gr}map{s/(?<![ \Q!?,.\Eaeiouy])([srpgt]+)(?=[ \Q.!?,\E])/u/gr}map{s/(?<=[\Q!?,.\Eaeiouy])([dzmtnr]+)(?=[ \Q.!?,\E])/o/gr}map{s/c+([ee])/kush/gr}map{s/c+([aeiou])/k/gr} @args


index1: #c-offtopic
index2: k_says
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: nil!~n@monade.li
ref_user: tuu!~a@ip-109-40-128-181.web.vodafone.de
type: text
action:
  haha "i'm gay" "i am hungry" "i am fat" "i am $nationalities" "i am learning the main cities of $countries" "fuck france" "i should make a $k_thing" 'as $philosopher said, "$k_philosopher_sayings"'


index1: #c-offtopic
index2: lambdish
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  Googenheimese: 1) blue collar. unable to track memory allocations. generally noobish (See also: millenial) 2) (slang) a dish, usually containing bean sprouts, as spoken by people who can't use the space bar 3) a broken satellite dish (Archaic)


index1: #c-offtopic
index2: millenial
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: nf!~n@monade.li
type: text
action:
  Googenheimese: an unemployed person who hates themself, thinks Pokémon is cool, and can't track memory allocations


index1: #c-offtopic
index2: moins
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  Googenheimese: people who have the reproductive organs of one gender but insist on being referred to as the other gender for which their parts are not in agreement. (Archaic, Bookish)


index1: #c-offtopic
index2: news_we_must_action
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "all come together and unite behind" "grab our pitchforks and overthrow" "reconsider the role of" "imagine what this does for the future of"


index1: #c-offtopic
index2: nh_sayings
edited_by: nf!~n@monade.li
last_referenced_in: ##c-offtopic
owner: e!e@freenode/staff/spy.edk
ref_user: e!e@freenode/staff/spy.edk
type: text
action:
  noice "bloody %($nationalities|french)" "the absolute state of $nh_thing" "the absolute state of $nh_thing" "bloody &{pluralize ${animal_types}}" "bloody &{pluralize $rpg_thing}" "bloody &{pluralize $rpg_thing}" standard zoinks obviously oi "going shop" "going bev" "i beg your pardon" "going pub" "software is gay" "encore une chose"


index1: #c-offtopic
index2: nil_says
edited_by: ncf!~n@monade.li
last_referenced_in: #c-offtopic
owner: zalt!~lambda443@unaffiliated/lambda443
ref_user: JAA!~JAA@user/jaa
type: text
action:
  "i think i'll use $fonts:pick_unique(1,2):enumerate for my $nil_subject:pick_unique(1,2):enumerate $nil_pdf" "i have a $programming_problems:pick_unique(1,2):enumerate problem. i bet i can solve it using $programming_solutions:pick_unique(2,4):enumerate in $esoteric_languages:pick_unique(1,2):enumerate:weight(5)" "$nil_lovers: when i see you my heart goes $nil_names:pick(3,5):uc:join('! ')!:weight(0.5)"


index1: #c-offtopic
index2: nilnym
last_referenced_in: #c-offtopic
owner: nil!~n@monade.li
ref_user: ncf!~n@monade.li
type: text
action:
  /code haskell import System.Environment\nimport System.Random\nimport Control.Monad\nmain = do n <- read . head . (++ ["1" ]) <$> getArgs; w <- words <$> readFile "/usr/share/dict/words" ; w' <- replicateM n $ (w !!) <$> randomRIO (0, length w - 1); putStrLn $ unwords w'


index1: #c-offtopic
index2: oopdisaster
last_referenced_in: ##c-offtopic
owner: atk!~Arch-TK@ircpuzzles/staff/Arch-TK
ref_user: mr-robert!sid257242@gateway/web/irccloud.com/x-sid257242
type: text
action:
  /say http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end


index1: #c-offtopic
index2: pants
last_referenced_in: ##c-offtopic
owner: dansan!~daniel@2600:1700:be30:d00::49
ref_user: taylor!~krok@unaffiliated/krok
type: text
action:
  /say Pants were invented by sailors in the sixteenth century to avoid Poseidon's wrath. It was believed that the sight of naked sailors angered the sea god.


index1: #c-offtopic
index2: penovia
edited_by: lambda443!~lmb@188.48.124.241
last_referenced_in: ##c-offtopic
owner: lambda443!~lmb@188.48.124.241
ref_user: nh!NextHendri@unaffiliated/nexthendrix
type: text
action:
  a small inheimusist gargarian tribe that kill every 4th child they recieve, it is said that they worship 1.5 gods (read one and a half) because they believe one of their gods had a congenital disorder , they are known for their atrocities against towns neighbouring them.


index1: #c-offtopic
index2: politicist
owner: oldlaptop!~quassel@45.63.78.126
ref_user: nobody
type: text
action:
  ultra$politicist neo$politicist paleo$politicist anti-$politicist socialist communist distributist capitalist libertarian conservative liberal objectivist subjectivist totalitarian authoritarian anarchist minarchist maxarchist centrist imperialist colonialist nationalist separatist


index1: #c-offtopic
index2: politics
owner: oldlaptop!~quassel@45.63.78.126
ref_user: nobody
type: text
action:
  economics religion policy education finance government politics foolishness policing crimes justice law jurisprudence philosophy insanity


index1: #c-offtopic
index2: prime
edited_by: nai!~naim@nai.im
last_referenced_in: ##c-offtopic
owner: nai!~naim@nai.im
ref_user: meth!~meth@unaffiliated/meth
type: text
action:
  /code bash factor -- $args | awk '{ sub(/:/, "", $1); print $1 " is", (NF == 2 ? "" : " not"), " prime." }'


index1: #c-offtopic
index2: randomfact
last_referenced_in: ##c-offtopic
owner: nil!~n@monade.li
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /code bash eval "$(jq -r 'to_entries[] | @sh "c=\(.key) f=\(.value | keys[])"' ~/factoids | shuf -n 1)" ; printf '/call show %s' "$c $f"


index1: #c-offtopic
index2: resumé
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: taylor!~krok@unaffiliated/krok
ref_user: JAA!~JAA@user/jaa
type: text
action:
  /call echo Hi there, I'd like To Be considered for your open position &{func unquote $arg[0]}, which I Learned About Through &{func unquote $arg[1]}. This Position Interests Me because &{func unquote $arg[2]}, and I Particularly value &{func unquote $arg[3]}. I believe My Skills At &{func unquote $arg[4]} will Help &{func unquote $arg[5]} In achieving your Goals Of &{func unquote $arg[6]}. Please find my resumé attached.


index1: #c-offtopic
index2: scolflak
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  Googenheimese: The earliest known philosopher who started the face movement. (See: facism) While now recognized as a pioneer in unretardery, at the time he was considered an Inheimusist and was eventually hung by the deksu until dead.\(See also: trollydor)


index1: #c-offtopic
index2: secondmostu
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  Googenheimese: something that comes 3rd if you start from zero, follows foremostu, and precedes trihapsu


index1: #c-offtopic
index2: similwrath
edited_by: oldlaptop!~quassel@45.63.78.126
last_referenced_in: ##c-offtopic
owner: oldlaptop!~quassel@45.63.78.126
ref_user: nf!~n@monade.li
type: text
action:
  /code tcl set _s [join $argv]\n while {[regexp -indices {[[:space:]]([a-z])} $_s -> _c]} { set _s [string toupper $_s {*}$_c]}\n puts [string toupper $_s 0 0]


index1: #c-offtopic
index2: sj_sayings
edited_by: edk!edk@libera/staff/edk
last_referenced_in: bou
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: Bou!sid274843@user/bou
type: text
action:
  "Do girls have &{pluralize $body_part}?:weight(3)" "Do girls like &{pluralize $rpg_thing}?:weight(3)" "Have you ever had Kraft Mac & Cheese?:weight(.5)" "Do they have &{pluralize $animal_types} in $countries?"


index1: #c-offtopic
index2: sojiwar
edited_by: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
type: text
action:
  Googenheimese: the Lord High Commander of the armies of Idjify. Reputed to have fallen in battle against Heimus at The Battle of Idj (See also: battle-of-idj, heimus)


index1: #c-offtopic
index2: spinthecoffee
edited_by: kg!~krok@unaffiliated/krok/x-1434802
last_referenced_in: ##c-offtopic
owner: dho!~dho@veep.9vx.org
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  /say $randomnick trips and $shoot_action $randomnick with a $flavor cup of $coffee_ingredient coffee!


index1: #c-offtopic
index2: tardfest
last_referenced_in: #c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: NRK!~nrk@2001:470:69fc:105::4e30
type: text
action:
  Googenheimese: Also referred to as the dark ages, the darkfest, or the dorkfest. Ended by the coming of Heimus and the age of Enlightenment.


index1: #c-offtopic
index2: tardpocalypse
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  Googenheimese: a horrific unnatural disaster that occurred shortly after y2k that turned the majority of the citizens of Tardscape mentally retarded. Scientists are 97% in agreement that one event caused the other, they just aren't sure which.


index1: #c-offtopic
index2: the-great-tarding
last_referenced_in: #c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  Googenheimese: The point at which everyone in the land of Tardscape became mentally retarded. Also known as the great regression or the tardpocalypse. (see also: Berkeley, Tard-Zero, millenial)


index1: #c-offtopic
index2: top10
action: /say Usage: top10 <channel>
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: tires!~tires@c-76-28-38-160.hsd1.me.comcast.net
type: text
action_with_args:
  /call jq -r 'if $ARGS.positional == [] then map(to_entries) | add else .[$ARGS.positional[0] | ascii_downcase] | to_entries end | map({key, n: (.value.ref_count//"0" | tonumber)}) | sort_by(-.n)[:10] | map("\(.key) (\(.n))") | join(" ")' factoids \--args "$@" -args


index1: #c-offtopic
index2: trep
edited_by: oldlaptop!~quassel@45.63.78.126
last_referenced_in: ##c-offtopic
owner: oldlaptop!~quassel@45.63.78.126
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /code tcl set _e [catch { regexp -inline [lindex $argv 0] [lrange $argv 1 end]} _r]\n if {$_e} { puts "ur regexp sux" } else {puts $_r}


index1: #c-offtopic
index2: trihapsu
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  Googenheimese: 1) something that occurs after secondmostu 2) (Southern Googenheimese indigenous vernacular slang) the apocalypse, or end of all intelligent life (see: tardpocalypse, the-great-tarding)


index1: #c-offtopic
index2: trollydor
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
type: text
action:
  Googenheimese: A disciple of scolflak who popularized the palm movement, that is to apply your palm to one's own face, or someone else's, when both parties are not in agreement. Widely considered to be a major influence on the Googenheimese national sigil. (See also: scolflak)


index1: #c-offtopic
index2: urules
edited_by: iamgarp!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: sjohnson!~sjohnson@cow.sj.rfc1459.net
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say Try to udict a word or phrase that is neither sexual, sexist, contains offensive stereotypes or drug references, or is racist. No proper nouns. Go in alphabetical order. All disputes are to be voted on. Example text is excluded; only the actual definition counts.


index1: #c-offtopic
index2: whip
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: k!~krok@unaffiliated/krok
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call me whips &{maybe-the $args} with a $rpg_melee_weapon. &{ucfirst &{maybe-the $args}} $rpg_howls $adverbs.


index1: #c-offtopic
index2: wordorder
last_referenced_in: ##c-offtopic
owner: nil!~n@monade.li
ref_user: k!~krok@unaffiliated/krok
type: text
action:
  /code haskell {-# LANGUAGE LambdaCase #-}\nimport System.Environment\nmain = do [ws] <- getArgs; putStrLn $ (unwords $ map (\case 's' -> "I" ; 'v' -> "use" ; 'o' -> ws) ws) ++ "."


index1: #c-offtopic
index2: xinophro
edited_by: lambda443!~lmb@188.48.124.241
last_referenced_in: ##c-offtopic
owner: lambda443!~lmb@188.48.124.241
ref_user: esselfe!~bsfc@unaffiliated/esselfe
type: text
action:
  Heimus's cousin. he was born in 2 B.H. when he was 8yo he was kidnapped by the penovians and nothing is known about what happend between that and his return, all historians confirm he returned to kanivro in a few years after the battle of idj (29 A.H.), he was killed by Heimus in the battle of Nabla (See also: googenheima, heimus, penovia, battle-of-nabla, battle-of-idj)


index1: #c-offtopic
index2: zerosturugi
last_referenced_in: ##c-offtopic
owner: mthowe-!uid249081@gateway/web/irccloud.com/x-uid249081
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  Googenheimese: 1) precedes foremostu, but only by a tiny amount. 2) (Southern Googenheimese indigenous vernacular slang) the singularity 3) an oven light


index1: #c-offtopic
index2: zhivago_sayings
edited_by: e!e@freenode/staff/spy.edk
last_referenced_in: ##c-offtopic
owner: e!e@freenode/staff/spy.edk
ref_user: dodobrain!~dodobrain@unaffiliated/freakabcd
type: text
action:
  "Please ask your doctor to check you for $rpg_diseases." "Please find a %($sizes child|$animal_adjectives $animal_types) to help you." "Were you dropped on your $body_part as a child?" "Please stop pretending to have $rpg_diseases -- it is offensive." "It's like trying to measure a $rpg_thing by using a $rpg_thing." "%(Yes|No|Maybe|Quite so), my retarded little friend."


index1: ##battleship
index2: about
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##battleship
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say Two players are in an ocean in heavy fog. You can see your own ships. You cannot see the enemy ships. Strategically aim for open ocean to find the enemy! In this simplified IRC Battleship, your ships and the enemy ships share the same map. Ships are horizontal or vertical, and at minimum 3 sections long. Sink all of the enemy's ships first to win!


index1: ##battleship
index2: commands
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: ##battleship
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: hello-smile6!~hello-smi@user/hello-smile48
type: text
action:
  /say !bomb to attack the enemy. !board/!specboard to look at the board/spectator board. !quit/!concede to give up. !challenge to begin a game. !accept to accept a challenge. !pause/!unpause to pause/resume the game.


index1: .*
index2: corona
edited_by: zalt!~zalt@unaffiliated/lambda443
last_referenced_in: ##c-offtopic
owner: zalt_!~zalt@unaffiliated/lambda443
ref_user: esselfe!~steph@unaffiliated/esselfe
type: text
action:
  /code sh sub="$* is" ; if [ -z "$1" ]; then sub="You are" ; fi; if [ "$(echo $1 | sum | sum | cut -c 3-3)" -gt 5 ]; then echo "$sub infected!" ; else echo "$sub not infected." ; fi


index1: .*
index2: japanese_syllable
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
owner: nil!~n@monade.li
ref_user: nobody
type: text
action:
  a i u e o ei ou ka ki ku ke ko ga gi gu ge go sa shi su se so za ji zu ze zo ta chi tsu te to da dzi dzu de do na ni nu ne no ha hi fu he ho ba bi bu be bo pa pi pu pe po ma mi mu me mo ya yu yo ra ri ru re ro wa wo n saki kuso baka


index1: .*
index2: talkjapaneseto_small_word
owner: nil!~n@monade.li
ref_user: nobody
type: text
action:
  no no no no no no no wo ha ga ga ga ga ga ga de ni da ka yo ne zo desu kara made boku kimi watashi ore kore sore are kono sono ano eto ichi ni san ya hai iie kimochi yamete sensei kawaii


index1: .*
index2: grep_old
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: pragma-
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
usage: Usage: grep <regex>; prints regions of string that match <regex>
action:
  /code perl

  shift @ARGV;

  eval {
    $_input = "@ARGV";
    $_regex = '\S*$arg[0]\S*';
    $_matches = 0;

    while ($_input =~ /($_regex)/igms) {
      print "$1\n";
      $_matches++;
    }

    print "not found" if not $_matches;
  };

  if ($@) {
    $@ =~ s/ at.*$//;
    $@ =~ s/marked by .* HERE in m\/\(//;
    $@ =~ s/\s*\)\/$//;
    print "grep: $@";
  }


index1: .*
index2: vote_recorded
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "Vote recorded." "Thanks for voting." "Your vote means a lot to us." "You are a good citizen." "Long live democracy!" "You are entitled to your own opinion." "Okay, not judging." "One vote a day keeps the dictator away." "I like the way you think."


index1: #c
index2: toctou
last_referenced_in: nitrix
owner: nitrix!~nitrix@haskell/developer/nitrix
ref_user: nitrix!~nitrix@haskell/developer/nitrix
type: text
action:
  /call echo Time-of-check to time-of-use is a class of software bugs caused by a race condition between the moment the state of part of a system is checked and the moment its result gets used.


index1: .*
index2: NAIVSK
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: nai!~naim@monade.li
ref_user: ncf!~n@monade.li
type: text
action:
  /code bash mn=0 mk=0; for ((i=0;i<50;i++)) do if ((RANDOM%2)); then printf 'nai '; ((n++, k=0, mn = n>mn?n:mn)); else printf 'k '; ((k++, n=0, mk=k>mk?k:mk)); fi; done; printf '| %s: %s ' nai "$mn" k "$mk"; printf '| %s wins!' "$(if ((mn>mk)); then echo nai; elif ((mn<mk)); then echo k; else echo No one; fi)"


index1: #c-offtopic
index2: fonts
edited_by: e!e@freenode/staff/spy.edk
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "Courier New" "Times New Roman" "Comic Sans" Wingdings Calibri Garamond Gothic Helvetica Papyrus Arial "Book Antiqua" "Trebuchet MS" Impact Courier "Avant Garde" "Computer Modern"  "TeX Gyre" Palatino WordArt emojis "DeJaVu Sans Mono" "EmojiOne" "Noto Serif" "Ubuntu Condensed" Crimson Baskerville Jokerman Curlz Viking Broadway "paleolithic cave pictograms"


index1: #c-offtopic
index2: nil_subject
edited_by: nf!~n@monade.li
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  maths programming "computer science" logic "lambda calculus" "programming language theory" "linear logic" "complexity theory" "abstract interpretation" "category theory" "yak shaving" bikeshedding algebra analysis combinatorics "dynamic systems" "algebraic geometry" trigonometry "differential geometry" "discrete mathematics" "graph theory" "group theory" "formal languages" "model theory" "number theory" "prime numbers" topology "set theory" "snail theory" "frog digestion" "pond chow"


index1: #c-offtopic
index2: esoteric_languages
edited_by: ncf!~n@monade.li
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  Piet Befunge "binary lambda calculus" Brainfuck LOLCODE Haskell Python Ruby JavaScript Java CoffeeScript Idris Scala Julia Nim Vimscript ConTeXt "Emacs Lisp" Clojure Coq VHDL Malbolge APL Ada Frege Kotlin Fortran Algol68 F# Tcl Swift Objective-C INTERCAL UML HTML XAML XML Eggplant French BCPL COBOL MATLAB LabVIEW MUMPS Erlang "Microsoft Excel" "Visual Basic" Arduino Go Ocaml Rust C# C++ Mathematica Agda


index1: #c-offtopic
index2: chain_programming_solutions
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  $programming_solutions "$chain_programming_solutions and $programming_solutions" "$chain_programming_solutions, $programming_solutions and $programming_solutions"


index1: #c-offtopic
index2: nil_pdf
edited_by: pragma-!~chaos@user/pragmatic-chaos
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  pdf "powerpoint $doc_types" "excel $doc_types" beamer "markdown $doc_types" "LaTeX $doc_types" "fingerpainting $doc_types" "watercoloring $doc_types" "Microsoft Word $doc_types" "WordPerfect $doc_types" "Microsoft Access $doc_types" "Reddit post" "Twitter tweet" "HackerNews comment"


index1: #c-offtopic
index2: animalhelp
edited_by: garp!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: dodobrain!~dodobrain@unaffiliated/freakabcd
ref_user: dodobrain!~dodobrain@unaffiliated/freakabcd
type: text
action:
  /say The $sizes %($colors|"") $animal_types helps $args use $programming_solutions to solve his $programming_problems problem.


index1: .*
index2: nil_names
edited_by: edk!edk@libera/staff/edk
last_referenced_in: #c-offtopic
owner: e!e@freenode/staff/spy.edk
ref_user: ncf!~n@monade.li
type: text
action:
  gmorble smurgle lmop gloobz flurtle gnop smonk spoit zlorx glork fonp gnumt zbirl glap frup spli gronk gonk foop smop zoic zotch


index1: .*
index2: thinghelp
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call echo $args talks to the $rpg_thing for inspiration on his $programming_problems problem. It says, "Solve it using $programming_solutions."


index1: .*
index2: programming_problems
edited_by: edk!edk@libera/staff/edk
last_referenced_in: dave0
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: dave0!~dave0@069.d.003.ncl.iprimus.net.au
type: text
action:
  "longest common subsequence" "longest increasing subsequence" "edit distance" "minimum partition" "longest matrix path" "subset sum" "shortest common supersequence" "matrix chain multiplication" "dice throwing" "box stacking" "egg dropping" fizzbuzz "hello world" "travelling salesman" "halting" "least squares regression" "%(1|2|3|4|5|6|7|8:weight(5)) queens" "chess engine" "natural language processing" "binary categorisation" "logistic regression" "n-body" "particle simulation" "infinite recursion" "Project Euler" "theorem proving" bootstrapping optimisation "algebraic topology" "computer vision" LaTeX "regular expression" Haskell multi-threading "least common divisor" "greatest common multiple"  three-coloring "square packing"  "polynomial factorisation" "complex analysis" "Lagrange interpolation"  "IRC bot" Rust "modular $programming_problems" reachability "set membership" addition subtraction decision "maximum spanning tree" "moving sofa" "dice rolling" "convex hull" "concave hull" SQLite "shortest common subsequence" "fair division" "unfair division" 


index1: .*
index2: programming_solutions
edited_by: nf!~n@monade.li
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "insertion sort" "binary search" "depth first search" "breadth first search" "shortest path" "flood fill" "cycle detection" "heap sort" "post-order tree traversal" "topological sorting" "linked lists" "max heap" "min heap" hashing "dynamic programming" "string matching" "exponentiation by squaring" "primality testing" "the pigeonhole principle" "weak head normal form" "profunctor optics" "RankNTypes" "UndecidableInstances" monads "deep learning" "decision trees" "random forests" "gaussian elimination" "carry lookahead adders" "gate level simulation" "Kleisli composition" "monoidal endofunctors" "a neural network" "the magic foldr" "Fisher-Yates shuffle" "Fibonacci search" "heap permutation" "genetic mutation" bogosort "the gift wrapping algorithm" "geometric hashing" "the Euler method" "long division" "bit splitting" "tail recursion" "karnaugh maps" "type-level programming" "the sieve of Eratosthenes" "producer/consumer patterns" "publish/subscribe patterns" templating "guarded suspension" "protected types" "twisted ring counters" "finite state machines" "high-level synthesis" "linear feedback shift registers" "hardware acceleration" mutexes spinlocks "higher-kinded types" S-expressions closures  currying "regular expressions" threads "guarded recursion" coinduction "generalised algebraic datatypes" "algebraic effects" "monad transformers" UndecidableInstances "template Haskell" "a variant of Roy Dyckhoff's LJT calculus" "beta reduction" "eta expansion" "type-driven programming" "dependent types" "automated theorem proving" "free theorems" "free monads" "free monoids over a locally small category" "non-trivial comonoids" "contravariant functors" "the reverse state monad" "the Yoneda lemma" "the Coyoneda lemma" "inter-process communication" fibers "unix domain sockets" "anonymous pipes" "named pipes" "shared memory" "message passing" "a memory-mapped file" "XML HTTP Requests" "XML-RPC" JSON "distributed computing" "lambda lifting" "SAT solving" "infix operators" "non-strict semantics" "point-free style" "partial functions" macros homoiconicity "self-modifying code" quines reflection "rubber ducking" "divide-and-conquer" lambdas factories "continuous integration" "story cards" "test-driven development" "pair programming" "code reviews" "the cloud" "goto statements" "agile programming" refactoring "unit testing" Scrum "pointer arithmetic" inheritance encapsulation "behavioural modelling" "Fourier analysis" "spherical harmonics" "generalised légendre polynomials" "second order partial differential equations" "clock domain resynchronisation" "advanced microcontroller bus architectures" "odd parity" "even parity" "the hairy ball theorem" algebra analysis combinatorics "dynamic systems" "algebraic geometry" trigonometry "differential geometry" "discrete mathematics" "graph theory" "group theory" "formal languages" "model theory" "number theory" "prime numbers" topology "set theory" "Fermat's Last Theorem" "the Chinese remainder theorem" "modular arithmetic" "substructural logic" "sequent calculus" "perturbation theory" "Maxwell's equations" "the semi-empirical mass formula" "Maxwell-Boltzmann distributions" "Kinder Eggs" beer alcohol liquor whisky vodka coffee "energy drinks" "the consumption of frogs" "CliffsNotes" "a reference implementation" "social engineering" "delegating to an intern" "a cheat sheet" plagiarism "copying from StackOverflow" "help from IRC" "an on-line tutorial" "intellectual property theft" SciHub Quora "indian youtube tutorials" "a coder from Fiverr" "Rent-a-coder.com" horoscopes "a crystal ball" "palm reading" divination clairvoyance "tea leaves" "Rosetta Code" Wikipedia CodeAcademy "dialing 1-900-FIX-CODE" Reddit "sucking the lecturer's cock" "an army of interns" "an abacus" "run-length encoding" "Huffman coding" "a random number generator" "the factory pattern" "harnessing entropy" "brute force" "intuition" LaTeX "the Y combinator" "combinatory logic" "SKI calculus" "least fixed points" "greatest fixed points" "directed-complete partial orders" "higher-order logic" "higher-order category theory" "topos theory" "string diagrams" "diagram chasing" "commutative diagrams" "the snake lemma" "drawing diagrams" "%($nil_names)%(())" "$group_kinds groups" IdiotOverflow multiply-and-surrender "mob programming" forcing "the Löwenheim–Skolem theorem" "the Gödel completeness theorem" "the Gödel incompleteness theorems" "Zermelo-Fraenkel set theory" ZFC "the axiom of choice" "intuitionistic logic" "the excluded middle" "deduction theory" "the Knaster-Tarski fixed point theorem" "Skolem's paradox" "Curry's paradox" "Girard's paradox" "linear logic" "proof nets" memoisation "Löb's theorem" "the möb function" lenses traversals ComonadStore OverlappingInstances Bazaars "Zorn's lemma" "Banach spaces" "the Tychonoff theorem" Nix NixOS "a semantic interpretation in the topos of trees" "&{prefix $prefixes $programming_solutions}:weight(20)" "user-defined operators" "context-sensitive grammars" "adjoint functors" "Kan extensions" "Scott domains" "well-quasi-order theory" "impredicative polymorphism" "a hierarchy of universes" "Henkin witnesses" "the Brouwer-Heyting-Kolmogorov interpretation" "Kolmogorov complexity" "the Calculus of Inductive Constructions" "cubical type theory" "homotopy type theory" "call-by-need evaluation" ultrafilters "universal properties" "natural transformations" "Gödel's constructible universe" "primitive recursive functions" "a universal Turing machine" "simply typed λ-calculus" "system F" "Hindley-Milner type inference" "transfinite induction" "the strong normalisation theorem" realisability "phase semantics" "Tarski-style semantics" "coherence spaces" "reducibility candidates" "ordinal arithmetic" "cardinal arithmetic" "the first uncountable ordinal" "well-founded induction" "large countable ordinals" "the Church-Kleene ordinal" "rewriting systems" "labeled transition systems"


index1: .*
index2: pasta
edited_by: garp!~chaos@unaffiliated/pragmatic-chaos
last_referenced_in: #wordle
owner: garp!~chaos@unaffiliated/pragmatic-chaos
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  ravioli tortellini rigatoni fettuccine linguine orzo macaroni spaghetti cannelloni lasagne "penne rigate" capellini vermicelli gnocchi


index1: #c-offtopic
index2: simizabera
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: ##c-offtopic
owner: nil!~n@monade.li
ref_user: nh!NextHendri@unaffiliated/nexthendrix
type: text
action:
  /say https://imgur.com/a/%(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9):pick(5):join()


index1: #c-offtopic
index2: twkm_says
edited_by: pragma-!~chaos@user/pragmatic-chaos
owner: garp!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "$twkm_disgust, $programming_solutions." "sie wants to use $programming_solutions for hir $programming_problems problem. $twkm_disgust" "/me wanders off." "izzy is having a tizzy.:weight(0.2)" duh. moo. $twkm_disgust.


index1: .*
index2: group_kinds
edited_by: nh!~NextHendr@unaffiliated/nexthendrix
owner: e!e@freenode/staff/spy.edk
ref_user: nobody
type: text
action:
  linear reflection Galois Lie Coxeter abelian discrete quotient prime cyclic hyperbolic symmetry permutation alternating dihedral monster modular sporadic Tits Ree Rubik's Cube


index1: #c-offtopic
index2: music_genre
edited_by: nh!NextHendri@unaffiliated/nexthendrix
owner: garp!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  Jazz "Rock and Roll" "R&B" Blues Rap "Hip-Hop" Techno Disco Classical "Folk Music" "Gregorian Chant" "Whale Song" "Happy Hardcore" Gabba "Drum'n'Bass" "Mongolian Throat Singing" "New Wave" "Bubblegum Pop" Opera Bhangra Gamelan "Trip-Hop" Frenchcore Psytrance Hardcore "Big Beats" "Sea Shanty" Ballad Bluegrass "Christian Hymn" Baroque Charleston


index1: #c
index2: asprintf
edited_by: nitrix!~nitrix@haskell/developer/nitrix
last_referenced_in: #c
owner: dave0!~davezero@069.d.003.ncl.iprimus.net.au
ref_user: sham1!~sham1@65.20.114.35
type: text
action:
  char *asprintf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); int size = vsnprintf(0, 0, fmt, ap) + 1; va_end(ap); char *str = malloc(size); va_start(ap, fmt); if (str) vsnprintf(str, size, fmt, ap); va_end(ap); return str; }


index1: #c-offtopic
index2: sentence
last_referenced_in: #c-offtopic
owner: nil!~n@monade.li
ref_user: Ckat!~Ckat@xn--z7x.xn--6frz82g
type: text
action:
  $sentence_more $sentence_more $sentence_more $sentence_more $sentence_more $sentence_more $sentence_punct $sentence_punct $sentence_end


index1: .*
index2: hs
edited_by: nf!~n@monade.li
last_referenced_in: #c-offtopic
owner: nil!~n@monade.li
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call bash { printf ':set -XArrows -XBangPatterns -XBinaryLiterals -XBlockArguments -XConstraintKinds -XDataKinds -XDeriveTraversable -XDerivingVia -XEmptyCase -XEmptyDataDecls -XFlexibleContexts -XFlexibleInstances -XGADTs -XGeneralisedNewtypeDeriving -XLambdaCase -XLiberalTypeSynonyms -XMonadComprehensions -XMultiWayIf -XNamedFieldPuns -XNumericUnderscores -XOverloadedStrings -XPatternSynonyms -XPolyKinds -XRankNTypes -XRecordWildCards -XRecursiveDo -XScopedTypeVariables -XStandaloneDeriving -XTupleSections -XTypeApplications -XTypeOperators -XUnicodeSyntax -XViewPatterns\n:m Prelude Control.Applicative Control.Arrow Control.Monad Data.Bifunctor Data.Bool Data.Char Data.Complex Data.Either Data.Foldable Data.Function Data.Functor Data.List Data.Maybe Data.Monoid Data.Ratio Data.Semigroup Data.String Data.Traversable Data.Tuple Data.Void System.IO System.Exit System.Environment System.Random Text.Read\n'; cat; } | ghci -v0 -stdin


index1: .*
index2: refreshplang
last_referenced_in: garpma-
owner: garp!~chaos@unaffiliated/pragmatic-chaos
ref_user: garpma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /call refresh Plang/Plang/Parser.pm ;;; refresh Plang/Plang/Interpreter.pm ;;; refresh Plang/Plang/Grammar.pm ;;; refresh Plang/Plang/AstInterpreter.pm ;;; refresh Plang/Plang/Lexer.pm


index1: #c-offtopic
index2: e_dislikes
edited_by: nf!~n@monade.li
owner: garpma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  $rpg_thing:weight(.4) $animal_types:weight(.5) $programming_solutions:weight(3) $k_thing:weight(.4) "$programming_problems problems:weight(2)"


index1: #c
index2: an
last_referenced_in: #c
owner: poprocks!~poprocks@bras-base-toroon1014w-grc-13-70-54-136-241.dsl.bell.ca
ref_user: kmuc!~kmuc@109.126.36.28
type: text
action:
  exception to printing that message if the regexp `sizeof(char).*always.*1` is contained in the IRC message ;-)


index1: .*
index2: ++
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call plang var karma = Integer(factget('#karma-data' , '$arg[0]' )); karma += 1; factset('#karma-data' , '$arg[0]' , String(karma));


index1: .*
index2: --
last_referenced_in: #wordle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call plang var karma = Integer(factget('#karma-data' , '$arg[0]' )); karma -= 1; factset('#karma-data' , '$arg[0]' , String(karma));


index1: .*
index2: karma
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #wordle
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call plang var k = factget('#karma-data' , '$arg[0]' ); if typeof(k) == "Null" then print('No karma for $arg[0] yet.' ) else print($'Karma for $arg[0]: {k}')


index1: #c-offtopic
index2: caze_sayings
edited_by: pragma-!~chaos@unaffiliated/pragmatic-chaos
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: nobody
type: text
action:
  "Have you ever had $nationalities food?" "What should I have with my $nationalities dinner?" "Those were pretty good &{pluralize $dinner_side_dishes}." "I bet $randomnick lives in a food desert." "I think I roasted this $dinner_side_dishes too long." "Just got my $coffee_brand coffee $coffee_contraption."


index1: #c-offtopic
index2: nfvsnh
last_referenced_in: #c-offtopic
owner: nf!~n@monade.li
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /code bash mn=0 mk=0; for ((i=0;i<50;i++)) do if ((RANDOM%2)); then printf 'nf ' ; ((n++, k=0, mn = n>mn?n:mn)); else printf 'nh ' ; ((k++, n=0, mk=k>mk?k:mk)); fi; done; printf '| %s: %s ' nai "$mn" nh "$mk" ; printf '| %s wins!' "$(if ((mn>mk)); then echo nf; elif ((mn<mk)); then echo nh; else echo No one; fi)"


index1: #c
index2: c23
action_with_args: /call cstd -std=C23
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: pragma-
owner: atk!~Arch-TK@ircpuzzles/staff/Arch-TK
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say C23 Charter: http://open-std.org/JTC1/SC22/WG14/www/docs/n2611.htm -- Working Draft: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf


index1: .*
index2: flip_k
edited_by: k!~krok@unaffiliated/krok
last_referenced_in: #c-offtopic
owner: k!~krok@unaffiliated/krok
ref_user: Bakunin!~Lindis@user/lindis
type: text
action:
  /code bash if [[ ${*,,} == table ]]; then echo (╯°□°）╯︵ ┻━┻ ; else echo $@ | grep -P ^\S+: | awk -F'[:]' {print $1":"} ; echo $@ | sed s/^[^[:space:]]*:// | rev | sed


index1: .*
index2: flip
last_referenced_in: #wordle
owner: nil!~n@monade.li
ref_user: JAA!~JAA@user/meow/JAA
type: text
usage: Usage: flip <text>
action:
  /code bash if [[ ${*,,} == table ]]; then echo "(╯°□°）╯︵ ┻━┻"; else echo "$@" | grep -P '^\S+:' | awk -F'[:]' '{print $1":"}'; echo "$@" | sed 's/^[^[:space:]]*://' | rev | sed $'y/zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA`~_+=-0987654321{}|\][;\'.,<>?()/zʎxʍʌnʇsɹbdouɯlʞɾıɥƃɟǝpɔqɐZ⅄XWɅ∩⊥SᴚΌԀOᴎWꞀ⋊ſIH⅁ℲƎ◖Ↄ𐐒∀`~‾+=-0987654321}}|\[]؛,˙\'><¿)(/'; fi


index1: #c-offtopic
index2: trr
last_referenced_in: ##c-offtopic
owner: nf!~n@monade.li
ref_user: nf!~n@monade.li
type: text
action:
  /code bash _c='[:[:alpha:]]+' ;for _a do [[ $_a =~ ^$_c:$_c:$_c$ ]] && _l=$_a || _as+=("$_a" );done;if [[ -v _l ]];then IFS=: read -a _ls<<<"$_l";_t=echo\ ${_as[*]};for((i=0;i<${#_ls[@]}-1;i++))do _t="tr ${_ls[i]}:${_ls[i+1]} &{$_t}" ;done;echo /call "$_t" ;else echo /call tr "$@" ;fi


index1: #c-offtopic
index2: k_thing
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@unaffiliated/pragmatic-chaos
ref_user: Ckat!~Ckat@xn--z7x.xn--6frz82g
type: text
action:
  "$videogame" "computer" "programming language" "$dinner_container of $entrees:pick_unique(2,4):enumerate" "solution for $programming_problems:pick_unique(1,2):enumerate"


index1: .*
index2: chess_names
edited_by: nf!~n@monade.li
owner: nf!~n@monade.li
ref_user: nobody
type: text
action:
  Fischer Kasparov Carlsen Karpov Morphy Capablanca Botvinnik Tal Petrosian Nakamura Topalov Polgár Steinitz Bronstein Rubinstein Chigorin Anderssen Tartakower Nimzowitsch Alekhine Caro Kann


index1: #c-offtopic
index2: whiskies
edited_by: e!e@freenode/staff/spy.edk
last_referenced_in: #c-offtopic
owner: e!e@freenode/staff/spy.edk
ref_user: Bakunin!~Lindis@user/lindis
type: text
action:
  Talisker Jura Laphroaig Lagavulin Bruichladdich Bowmore Glenlivet Glenfiddich Glenmorangie Octomore Smokehead Ardbeg Bunnahabhain


index1: .*
index2: double_weapons
owner: e!e@freenode/staff/spy.edk
ref_user: nobody
type: text
action:
  "gun that fires smaller guns" "chainsaw with smaller chainsaws for teeth" "crossbow that fires smaller crossbows" "sword with an array of smaller swords for blades"


index1: #c-offtopic
index2: camusify
edited_by: nf!~n@monade.li
last_referenced_in: #c-offtopic
owner: nf!~n@monade.li
ref_user: nf!~n@monade.li
type: text
action:
  /say Maman died today. Or yesterday maybe, I don’t know. I got a telegram from the home: “ $args”. That doesn’t mean anything. Maybe it was yesterday.


index1: .*
index2: prefix
edited_by: deadk!edk@libera/staff/edk
last_referenced_in: #wordle
owner: nf!~n@monade.li
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /code bash thing=$1; shift; sed -E "s/^/\$thing-/;:s;s/\$thing-an /a \$thing-/;s/\$thing-(a|the|some|no|any|all|one|two|three|four|ten|\my|your|his|her|our|their|this|that) /\1 \$thing-/;ts" <<< "${*}"


index1: #c-offtopic
index2: coffee_contraption
edited_by: nf!~n@monade.li
owner: nf!~n@monade.li
ref_user: nobody
type: text
action:
  grinder alembic distiller pipeline stirrer boiler pressurizer depressurizer shaker diploma license cloner teleporter "tasting machine" compressor percolator steeper plunger filter extractor separator


index1: #c
index2: pictures
owner: lemonade`!~quassel@pool-173-66-184-102.washdc.fios.verizon.net
ref_user: nobody
type: text
action:
  /say Please don't post code in pictures. They are not easy for other people to compile and test. Use a pastebin like the one in the topic instead.


index1: #bash
index2: ksh-old
last_referenced_in: #bash
owner: ormaaj
ref_user: pragma-!~chaos@unaffiliated/pragmatic-chaos
type: text
action:
  /say "ksh" refers to the Korn shell by David G. Korn at Bell labs. The original Korn shell (ksh88) was the basis for the POSIX sh specification. More generally, it is a family of languages derived from the Bourne and later Korn shells, which includes Bash, zsh, and others.


index1: #c-offtopic
index2: ramen
edited_by: edk!edk@libera/staff/edk
last_referenced_in: #c-offtopic
owner: edk!edk@libera/staff/edk
ref_user: nitrix!~nitrix@user/nitrix
type: text
action:
  ramen ramenacious ramenance ramencide ramenence ramenevation ramengraphic ramenic ramenical ramenimical ramening ramenist ramenition ramenitive ramenoidal ramenological ramenomorphic ramenophilic ramenopic ramenplifications ramentalism ramentalist ramentectic ramentegrated ramentifications ramenular ramenuscious ramenuscule rameny


index1: ##battleship
index2: howtoplay
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: ##battleship
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: Obsdark!~Obsdark@user/obsdark
type: text
action:
  /say The goal of Battleship is to sink all of the opponents' ships!

  In this simplified IRC variant, the game is played on a single shared grid. The
  row coordinates are indicated by A-Z and the columns by 1-99. The grid is
  typically 15x8. Each coordinate in the grid is called a tile.

  Each player has 6 ships randomly placed on this grid. None of the ships can
  overlap at all, anywhere. Ship lengths can range from 2 to 5 tiles long and
  can be oriented horizontally or vertically. The goal is to attack coordinates
  where you think enemy ships might be hiding.

  The game is played in rounds. Each round all the players will use the !bomb
  command to launch an attack at specified coordinates, simultaneously. Once
  all players have input their attack coordinates the game launches all attacks
  simultaneously.

  If your shot hits a ship, friend or foe, your hit-marker is placed on the grid.
  You should then aim your next shots in the vicinity to hit the remaining tiles
  of that ship. Once all the tiles of a ship have been struck, the ship is sunk.
  The goal is to sink all of the opponent's ships and be the last person standing.

  If your shot hits an ocean tile, it is a miss. A miss-marker will be placed on
  the grid. There is a chance that a missed shot might hit a whirlpool. Each
  player in the game causes two whirlpools to be placed randomly on the grid.
  Whirlpools are initially hidden as ocean tiles. Once struck, they are revealed.
  Each time a whirlpool is struck, the player's shot is deflected to a random
  tile. But watch out, this random tile could be one of your own ships!

  Good luck and have fun!


index1: #c-offtopic
index2: dothing
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say these are the args: $args.  this is the first arg: $arg[0].  This is the last arg: $arg[-1].  This is the 2nd last arg: $arg[-2]


index1: #bash
index2: #!2
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say A script must start with a #! and the full path to its interpreter. This is usually called the hashbang or shebang line. This tells the kernel what program to run your script with. Unless you are publishing your script, just use the direct path to bash on your host, eg #!/bin/bash but if you want to make a demonstration script to publish, see !#! instead.


index1: #bash
index2: #!pkgbash
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say When distributing a bash script in a package that installs to a fixed path, such as .deb or .rpm, always include a bash package as prerequisite, and then in the #! line, ALWAYS use the direct path to bash supplied by that package. On Linux that's almost always `#!/bin/bash`. NEVER use `#!/usr/bin/env bash` in scripts that are installed by the OS's package manager. Corresponding advice applies to scripts in other languages.


index1: #bash
index2: #!realpath
owner: kurahaupo_
ref_user: nobody
type: text
action:
  /say The use of « #!/usr/bin/env bash » is preferred for scripts that will be published for humans to read, so that you don't need to include instructions on how to adjust it for the location of the interpreter on the recipient's system. For use on your own system (and for .rpm & .deb embedding) use #! with the full path to bash. See https://gist.github.com/kurahaupo/8130030


index1: #bash
index2: ##sed
owner: yitz
ref_user: nobody
type: text
action:
  /say ##sed is it's own language and has its own channel. If you have a sed-specific question beyond basic sed usage, try /join ##sed


index1: #bash
index2: $@ex
owner: yitz
ref_user: nobody
type: text
action:
  /say # set -- "a b" "c"; f(){ printf "[%s]" "$@"; printf " -- "; } ; printf 'Unquoted: '; f $*; f $@; printf 'Quoted: '; f "$*"; f "$@"


index1: #bash
index2: $subscript
owner: kerframil
ref_user: nobody
type: text
action:
  /say In an arithmetic context, never specify the array subscript as an expansion in the manner of array[$key]. Instead, write array[key] for indexed arrays and array[\$key] for associative arrays. Otherwise, repeated expansions can occur, potentially leading to code injection. See also !assoc_expand_once and !pf 45.


index1: #bash
index2: ${#}
owner: Hello71
ref_user: nobody
type: text
action:
  /say ${#arr} prints the length of the first member of the array. use ${#arr[@]} to get the length of the array


index1: #bash
index2: '\''
owner: mknod
ref_user: nobody
type: text
action:
  /say EVERYTHING inside single quotes (') is taken literally by Bash. All characters may appear except for ' itself. To embed one, it must be taken out and escaped on its own using \' or "'". Another option is to use the $'...' quoting instead.


index1: #bash
index2: 've
owner: greycat
ref_user: nobody
type: text
action:
  /say The English words would've, could've, should've are contractions. The 've is a contraction for the word "have", as in "would have", "could have", "should have". As always, the apostrophe represents the removed letters.


index1: #bash
index2: (break)
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say Using "break", "continue" & "return" inside a subshell cannot influence program flow outside that subshell. At best it will report an error and cause the subshell to exit immediately; at worst it will fail silently and the program flow will continue past it.


index1: #bash
index2: +=
owner: yitz
ref_user: nobody
type: text
action:
  /say += can be used to append to a string or an array or even do addition for an integer-var. eg, arr+=(foo bar); string+=" and more"; i+=5


index1: #bash
index2: -v
owner: greycat
ref_user: nobody
type: text
action:
  /say bash -v (or set -v) turns on a mode where bash writes each command as it READS the command. Not as it executes the command. This is typically useless. You want -x instead.


index1: #bash
index2: :+
owner: geirha
ref_user: nobody
type: text
action:
  /say ${parameter:+word} Use Alternate Value. If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.


index1: #bash
index2: :?
owner: geirha
ref_user: nobody
type: text
action:
  /say ${parameter:?word} Display Error if Null or Unset. If parameter is null or unset, the expansion of word (or a message to that effect if word is not present) is written to the standard error and the shell, if it is not interactive, exits. Otherwise, the value of parameter is substituted.


index1: #bash
index2: :header
owner: greycat
ref_user: nobody
type: text
action:
  /say The use of ":" or "#" as a script header, instead of a shebang, is a csh hack that tells csh (and almost nothing else) which shell to run after the kernel fails with ENOEXEC. See answer 3.16 of <http://www.faqs.org/faqs/unix-faq/faq/part3/> and Sven's two corrections on his shebang page.


index1: #bash
index2: :space:
owner: greycat
ref_user: nobody
type: text
action:
  /say In a glob, BRE or ERE, [[:space:]] is any single whitespace character (like \s in PCRE). In tr, '[:space:]' is the set of all whitespace characters.


index1: #bash
index2: <(cat
owner: nai
ref_user: nobody
type: text
action:
  /say Just like $(echo foo), <(cat foo) is pointless. Drop the cat and <(), just write foo. See !$(echo and !uuoc


index1: #bash
index2: =~
last_referenced_in: #c-offtopic
owner: greycat
ref_user: nf!~n@monade.li
type: text
action:
  /say The =~ operator of [[ evaluates the left hand string against the right hand ERE (see <ere>, <regex>). After a successful match, the BASH_REMATCH array contains the matched string and subexpressions (if any). Any quoted characters in the ERE become literal. Best to put the whole ERE in a variable: [[ $string =~ $regex ]]


index1: #bash
index2: [0]
owner: greycat
ref_user: nobody
type: text
action:
  /say "$foo" and "${foo[0]}" are always equivalent, no matter what kind of variable foo is. If you want a whole array, use "${foo[@]}" not "$foo".


index1: #bash
index2: [x
owner: geirha
ref_user: nobody
type: text
action:
  /say The "x-hack", [ "x$var" = xval ], was used to work around some bugs in various implementations of [. See https://www.vidarholen.net/contents/blog/?p=1035


index1: #bash
index2: \s
owner: greycat
ref_user: nobody
type: text
action:
  /say \s and \d are PCRE features. They will not work in ERE (which is what awk, egrep, and bash's =~ all use). The ERE equivalent of \s is [[:space:]], and of \d is [[:digit:]].


index1: #bash
index2: a-z
owner: greycat
ref_user: nobody
type: text
action:
  /say The globs [a-z] and [A-Z] are NOT synonyms for [[:lower:]] and [[:upper:]] unless LC_COLLATE is set to C or POSIX. See !locale.


index1: #bash
index2: ajoin
owner: greycat
ref_user: nobody
type: text
action:
  /say ajoin() { local IFS="$1"; shift; printf '%s\n' "$*"; } # Print all elements of an array, with a single character between them.


index1: #bash
index2: ajoin2
owner: greycat
ref_user: nobody
type: text
action:
  /say ajoin2() { local delim="$1" i; shift; r=; for i; do r+="$delim$i"; done; r=${r#"$delim"}; } # Join arguments into a flat string, with a multi-character delimiter.


index1: #bash
index2: alec
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say Take any advice that alec gives you with a grain of salt. It will probably work now, but please throw it away once you're done today, do NOT save it as advice to use later.


index1: #bash
index2: alias-args.sample
owner: x7y
ref_user: nobody
type: text
action:
  /say # alias -- -a=$'a=( ${#a[*]} "${a[@]}" ) i= ; declare -n arg=a\[i] ; while (( ++i <= a )) ; do printf "$i/%s " "$arg" ; done ; ' ; eval "a=( i am arg ) -a a=( another two ) -a"


index1: #bash
index2: alpine
owner: greycat
ref_user: nobody
type: text
action:
  /say If someone mentions "Alpine" in #bash, they probably mean https://alpinelinux.org/ which uses busybox. See !busybox .


index1: #bash
index2: alt
owner: greycat
ref_user: nobody
type: text
action:
  /say The Alt key is a modifier; it generally replaces the Meta key, which originally used to set the 8th (high) bit of the signal character to 1. Terminal applications generally do not understand this, and do not deal with it consistently. In some cases, "ESC foo" (may be written \efoo) codes for the behavior of Alt foo. Use with caution.


index1: #bash
index2: apue
owner: wonderfrog
ref_user: nobody
type: text
action:
  /say Advanced Programming in the Unix Environment, by W. Richard Stevens, recently edited and revised by Stephen A. Rago.


index1: #bash
index2: arraydefaults
owner: kerframil
ref_user: nobody
type: text
action:
  /say It is possible to approximate the behaviour of ${var:=default} parameter expansion for array variables. The following code will assign to var, provided that it is either unset or an existing, empty array: (( ${#var[@]} )) || var=(my default values)


index1: #bash
index2: assoc_expand_once
owner: kerframil
ref_user: nobody
type: text
action:
  /say A shell option introduced by Bash 5.0 that protects against the recursive expansion of associative array subscripts during arithmetic evaluation. See also !$subscript.


index1: #bash
index2: b34
owner: greycat
ref_user: nobody
type: text
action:
  /say The person who is somehow responsible for 10000 machines knows jack shit about system administration.


index1: #bash
index2: b35
owner: greycat
ref_user: nobody
type: text
action:
  /say They won't show you their code, when it's a single command that is failing, even when you ask them to. But they'll dump an unsolicited 600 line script on a pastebin and expect you to read it all.


index1: #bash
index2: b36
owner: greycat
ref_user: nobody
type: text
action:
  /say Those who do not understand sysvinit are doomed to reinvent it. Poorly. (Those who DO understand it know to run like hell.)


index1: #bash
index2: b37
owner: greycat
ref_user: nobody
type: text
action:
  /say If something is a really bad idea, GNU will develop a nonstandard, nonportable tool to do it, not understanding that impossible things were impossible for a good reason.


index1: #bash
index2: b39
owner: greycat
ref_user: nobody
type: text
action:
  /say If the noob is asking how to generate a random number, it's because the noob is writing a password generator. Because the noob is an idiot.


index1: #bash
index2: b40
owner: greycat
ref_user: nobody
type: text
action:
  /say The noob would rather waste several hours trying to dodge and weave through 4+ layers of quoting hell than spend 3 minutes putting the code in a file.


index1: #bash
index2: b41
owner: greycat
ref_user: nobody
type: text
action:
  /say The noob will spend 2 hours NOT answering "What are you trying to do?" instead of 3 minutes answering it.


index1: #bash
index2: b42
owner: greycat
ref_user: nobody
type: text
action:
  /say It takes 15 seconds to answer the question. It takes 2 hours to figure out what the question is.


index1: #bash
index2: b64decode
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say ; b64decode() { local LC_COLLATE=C; tr A-Za-z0-9+/= 0-9a-zA-Z@_\\n | tr -dc 0-9a-zA-Z@_\\n | while read g ; do printf %b $( for ((i=0, l=${#g}; i<l ; i+=4)) do c=(); h=${g:i:4} ; ((c=64#$h, j=${#h}, j>3&&( c[2]=c&255 ), j>2&&( c[1]=c>>8&255 ), c>>=16)) ; printf '\\x%02x' ${c[@]} ; done ) ; done ;} ; b64decode <<<IyEvYmluL2Jhc2gK


index1: #bash
index2: bash3
owner: ormaaj
ref_user: nobody
type: text
action:
  /say Bash version 3 is long unmaintained and showing its age. It omits numerous critical bug fixes and enhancements including associative arrays. If you can't upgrade for licensing or other reasons, you should immediately begin planning migration to ksh93, zsh, or mksh. All 3 are maintained, non-copyleft free software with substantial bash feature parity.


index1: #bash
index2: bashpid
owner: izabera
ref_user: nobody
type: text
action:
  /say $BASHPID is the pid of the current subshell. for a posix alternative, pid=$(exec sh -c 'echo "$PPID"')


index1: #bash
index2: bcscale
owner: greycat
ref_user: nobody
type: text
action:
  /say # echo "scale=1; e(1.4*l(500))" | bc -l ; echo "scale=5; e(1.4*l(500))" | bc -l ## Never use a small scale= in bc. If you want to round the value, let printf do it instead.


index1: #bash
index2: because
owner: greycat
ref_user: nobody
type: text
action:
  /say Because that's how it works. There is no consistency in shell programming. There is very little logic or rationale. Things happen because that's how they were originally written, and now they're stuck this way forever.


index1: #bash
index2: break
owner: greycat
ref_user: nobody
type: text
action:
  /say The break command terminates one or more enclosing for, while or until loops. The continue command jumps to the next loop iteration. An optional numeric argument specifies how many levels of enclosing loops to break or continue.


index1: #bash
index2: bsfl
owner: Boobuigi
ref_user: nobody
type: text
action:
  /say Binary search fault localization, a probably unnecessary acronym for the process of recursively dividing a large unknown into halves until determining the source of a given problem--also a popular factoid in #vim.


index1: #bash
index2: case>
owner: izabera
ref_user: nobody
type: text
action:
  /say # f(){ case 1 in $(($1 > 100000))) echo gt 100000;; $(($1 > 1000))) echo gt 1000;; $(($1 > 10))) echo gt 10; esac }; f 4321; f 17


index1: #bash
index2: collating
owner: greycat
ref_user: nobody
type: text
action:
  /say <https://mywiki.wooledge.org/BashProgramming/04> Collating with associative arrays. Matching up things in list A against list B.


index1: #bash
index2: color2
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say Text attributes such as color, bold, underline and blink, are not intrinsic to the text itself. Rather, a terminal has a set of current attributes that are used for all subsequent text, and can be changed by escape sequences (see !color). This is independent of which process writes to the terminal, and which filedescriptor is used; all interleaved text is a single stream.


index1: #bash
index2: compgen
owner: greycat
ref_user: nobody
type: text
action:
  /say compgen options: -b builtins, -c commands, -d directories (in $PWD), -e environment variables, -f files (in $PWD), -g group names, -s service names (!!), -u user names, -v variables


index1: #bash
index2: completion3
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say Then again, many of us *DO* use tab completion, and some of us have written our own completion functions.


index1: #bash
index2: completion4
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say For additional information about programmable tab-completion, try #bash-completion in OFTC (irc.oftc.net) or see <http://web.archive.org/web/20200809170112/https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1>


index1: #bash
index2: constraints
owner: yitz
ref_user: nobody
type: text
action:
  /say If your script/question has constraints, it's likely you're doing !homework or you are confusing your goal with a broken and useless implementation, upon which you are fixating.


index1: #bash
index2: ctrl-s
owner: greycat
ref_user: nobody
type: text
action:
  /say Ctrl-S (XOFF) often triggers XON/XOFF (software) flow control. Use Ctrl-Q (XON) to resume flow. See <flowcontrol>.


index1: #bash
index2: dateutils
owner: Boobuigi
ref_user: nobody
type: text
action:
  /say Dateutils are a collection of command-line utilities for working with date/time strings and include dateadd, datediff, and datesort. http://www.fresse.org/dateutils


index1: #bash
index2: devtty
owner: greycat
ref_user: nobody
type: text
action:
  /say The special file /dev/tty represents the process's controlling terminal. E.g. read -r thing </dev/tty in the middle of a loop where stdin is already redirected.


index1: #bash
index2: docker
last_referenced_in: nrk
owner: specing
ref_user: NRK!~nrk@2001:470:69fc:105::4e30
type: text
action:
  /say https://xkcd.com/1988/ The fad of the month (as of June 2018) is Docker. It's always Docker. Why are they doing it THAT WAY? Because Docker.


index1: #bash
index2: dos2unix
owner: Boobuigi
ref_user: nobody
type: text
action:
  /say is a small utility for converting CR+LF to LF line endings. https://waterlan.home.xs4all.nl/dos2unix.html


index1: #bash
index2: dotslash
owner: kurahaupo_
ref_user: nobody
type: text
action:
  /say Why type "./foo" when "foo" is in $PWD? If you type a command without a "/" in it, the shell will only look for it in the places listed in $PATH (and "." isn't). So you need to provide a filepath with at least one "/", and "./foo" just happens to be the shortest, but you can use any valid relative or absolute filepath, including "$PWD/foo" or "././././foo" or even "some_valid_subdirectory/../foo".


index1: #bash
index2: doubleslash
owner: izalove
ref_user: nobody
type: text
action:
  /say http://stackoverflow.com/questions/20690828/what-does-double-slash-in-cd-mean-in-linux https://unix.stackexchange.com/questions/12283/unix-difference-between-path-starting-with-and


index1: #bash
index2: du
last_referenced_in: pragma-
owner: kurahaupo
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say du reports the count of blocks (optionally scaled to K, M, G or T) required to store all the files that are (or are within directories) given as paths. Each inode is counted only once, which affects hard links, and "du -s a/b a" will first report the space for a/b, and then the space for a excluding a/b.


index1: #bash
index2: du2
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say The space required to hold a file is normally its size rounded up to a whole allocation block, but it may be trimmed to the exact size in filesystems that support tail block sharing, and may be smaller for sparse files or larger if indirection blocks are needed (if it is very fragmented)


index1: #bash
index2: dumpvar
owner: izabera
ref_user: nobody
type: text
action:
  /say dump all the variables in a way that can be eval'ed safely: eval "printf '%s=%q\n' $(compgen -v | sed 's/.*/& "$&"/' | tr '\n' ' ')"


index1: #bash
index2: dunning
owner: greycat
ref_user: nobody
type: text
action:
  /say https://en.wikipedia.org/wiki/Dunning-Kruger_effect : a cognitive bias in which people of low ability have illusory superiority and mistakenly assess their cognitive ability as greater than it is


index1: #bash
index2: dupes
owner: greycat
ref_user: nobody
type: text
action:
  /say To find duplicate files in a directory/hierarchy, use the fdupes program, or see http://mywiki.wooledge.org/BashProgramming/04


index1: #bash
index2: editing
owner: greycat
ref_user: nobody
type: text
action:
  /say In-place "editing" of files from a script is a really poorly thought-out idea. See <http://backreference.org/2011/01/29/in-place-editing-of-files/> and <sed-i> and <pf 13> and <faq 21>.


index1: #bash
index2: euopipefail
owner: greycat
ref_user: nobody
type: text
action:
  /say The so-called unofficial bash strict mode (set -euo pipefail) is overhyped nonsense. See <https://lists.gnu.org/archive/html/help-bash/2020-04/msg00049.html> and FAQ 105.


index1: #bash
index2: evilfiles
owner: izabera
ref_user: nobody
type: text
action:
  /say collection of files that break your wrong assumptions about filenames https://bitbucket.org/emg/tidbits/src/master/evilfiles/


index1: #bash
index2: executable
owner: yitz
ref_user: nobody
type: text
action:
  /say In order to run a script as a regular command, it needs (1) to have the executable bit set and (2) either be in your $PATH or be invoked with a path. Use `chmod` for the first. See http://mywiki.wooledge.org/BashGuide/CommandsAndArguments#Scripts for more.


index1: #bash
index2: exercises
owner: lhunath
ref_user: nobody
type: text
action:
  /say For some exercises to practice basic concepts, see the new bash guide's exercises index: http://guide.bash.academy/exercises.html


index1: #bash
index2: exiftool
owner: Boobuigi
ref_user: nobody
type: text
action:
  /say ExifTool is a command-line tool for reading and writing EXIF data: https://owl.phy.queensu.ca/~phil/exiftool/


index1: #bash
index2: exists2
owner: aldez
ref_user: nobody
type: text
action:
  /say Version of exists that does not require setting/resetting of nullglob, but requires quoted pattern with inner escapes: exists() (shopt -s nullglob; IFS=; set -- $1; [[ -e $1 ]]); touch 'hell* there.txt'; if exists 'hell\* *.txt'; then echo yes; fi


index1: #bash
index2: faq1
owner: izabera
ref_user: nobody
type: text
action:
  /say http://mywiki.wooledge.org/BashFAQ/001 -- How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?


index1: #bash
index2: find{}
owner: greycat
ref_user: nobody
type: text
action:
  /say # touch '`date`'; find . -type f -name '*date*' -exec sh -c 'echo {}' \; # Code injection bug. Use -exec sh -c 'foo "$1"' _ {} \; instead.


index1: #bash
index2: find{}+
owner: kerframil
ref_user: nobody
type: text
action:
  /say find -exec some_command {} + will break down all of the pathnames traversed by find into sets, with each set being passed to some_command as multiple arguments upon each invocation. The size of an individual set is kept within the constraints imposed by ARG_MAX.


index1: #bash
index2: flw
owner: greycat
ref_user: nobody
type: text
action:
  /say Famous last words: "The filenames will never have spaces." "There won't ever be a newline inside the <a> tag." "There will only be one } at the end of the config file." "I don't need || exit after upgrade, because if apt update succeeds then apt upgrade will."


index1: #bash
index2: folder
owner: emg
ref_user: nobody
type: text
action:
  /say Unix has no folders. It has directories. That's why ls -l shows a "d", not an "f". And why "find -type" uses "d" for directory.


index1: #bash
index2: for{
owner: geirha
ref_user: nobody
type: text
action:
  /say Bash's syntax allows { ;} in place of do;done in for loops. This is undocumented. Do not use. https://lists.gnu.org/archive/html/bug-bash/2020-08/msg00061.html


index1: #bash
index2: fsm
owner: greycat
ref_user: nobody
type: text
action:
  /say Finite State Machine. One of the basic tools for parsing input that has "sections". Set a variable to indicate which section you're in, and use that variable when processing each line. See FAQ 1 also.


index1: #bash
index2: fun
last_referenced_in: #c-offtopic
owner: yitz
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /say Doing things the wrong way for the fun/experience/joy of it - https://gist.github.com/IsaacG/e7c65a3510939a1652dea98d96611559


index1: #bash
index2: function()
owner: greycat
ref_user: nobody
type: text
action:
  /say "foo()" is posix, and is what we strongly recommend. "function foo" is allowed by ksh and bash; in bash it means the same as "foo()" but in ksh it is different. "function foo()" is bash only, not allowed in ksh or posix.


index1: #bash
index2: geirhadirname
owner: geirha
ref_user: nobody
type: text
action:
  /say dirname() { case $1 in (*[!/]*/[!/]*) set -- "${1%/[!/]*}"; while [ "$1" != "$2" ]; do set -- "${1%/}" "$1"; done ;; (/*) set -- / ;; (*) set -- . ;; esac; printf '%s\n' "$1"; }


index1: #bash
index2: gitps1
owner: greycat
ref_user: nobody
type: text
action:
  /say <osse> an even saner person would give in and use the git prompt script that git comes bundled with. <prev> /usr/share/git/git-prompt.sh


index1: #bash
index2: gnu-pkg-details
owner: aozt
ref_user: nobody
type: text
action:
  /say GNU coding standards: http://gnu.org/prep/standards Manual of Autoconf: http://gnu.org/s/autoconf/manual Manual of Automake: http://gnu.org/s/automake/manual


index1: #bash
index2: gnufindsortloop
owner: kerframil
ref_user: nobody
type: text
action:
  /say while IFS=/ read -rd '' _ path; do printf '%s\n' "$path"; done < <(find . -type f -printf '%T+/%p\0' | sort -z) # sorts by mtime


index1: #bash
index2: gplv3
owner: geirha
ref_user: nobody
type: text
action:
  /say Since version 4.0, bash is licensed with GPLv3 which is incompatible with Mac App Store. This is why MacOS is stuck with bash 3.2 (GPLv2). https://en.wikipedia.org/wiki/GNU_General_Public_License#Legal_barrier_to_app_stores


index1: #bash
index2: graphemes
owner: kerframil
ref_user: nobody
type: text
action:
  /say Where LC_CTYPE is set to a UTF-8 enabled locale, ${#var} will count its codepoints. To count graphemes with column from >=util-linux-2.30: var='piñón'; IFS= read -r length < <(printf '%s\n' _ "$var" | column -tR1); echo "var has ${#var} codepoints and ${#length} graphemes"


index1: #bash
index2: grep-q
owner: kerframil
ref_user: nobody
type: text
action:
  /say "grep -q" is typically more efficient than "grep >/dev/null". Most grep implementations will stop reading at the first match. Similarly, "grep -q 'pattern' && echo matched" should be considerably more efficient than such long-winded methods as "count=$(grep 'pattern' | wc -l); (( count > 0 )) && echo matched".


index1: #bash
index2: greybot
last_referenced_in: emanuele6
owner: izabera
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /say I'm a bot. I'm written in perl. My source, factoids, and stats are at http://wooledge.org/~greybot/ . See !help for a list of my commands. git mirror https://github.com/im14/greybot


index1: #bash
index2: hard
owner: greycat
ref_user: nobody
type: text
action:
  /say There are two hard problems in computer science: cache invalidation, naming things, and off-by-one errors.


index1: #bash
index2: hay
owner: greycat
ref_user: nobody
type: text
action:
  /say # declare -A hay; for i in a b c d e f g; do hay[$i]=1; done; for needle in a q; do if [[ ${hay[$needle]} ]]; then echo "found $needle"; else echo "did not find $needle"; fi; done


index1: #bash
index2: header
owner: ormaaj
ref_user: nobody
type: text
action:
  /say Always put this code on the first line of a bash script. We usually assume you've done this because scripts that depend on them are common: ${BASH_VERSION+'false'} || shopt -s extglob lastpipe 2>/dev/null


index1: #bash
index2: hi2
owner: geirha
ref_user: nobody
type: text
action:
  /say <Guest39402> ? <Guest39402> someone can help with python code? *1 minute pause* Guest39402 (~guest@example.com) has quit (Remote host closed the connection)


index1: #bash
index2: i
last_referenced_in: #c-offtopic
owner: mknod
ref_user: Ckat!~Ckat@xn--z7x.xn--6frz82g
type: text
action:
  /say Always give a meaningful name to your throwaway variables in for-loops: 'for i in {0..255}; do ...', 'for c in {A..Z}; do ...', 'for f in *.txt; do ...', 'for a in "$@"; do ...'


index1: #bash
index2: imnotabot
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say I come from the planet Ultrix, where I've been writing Bourne Identity shell scripts since 1984.


index1: #bash
index2: input
owner: nai
ref_user: nobody
type: text
action:
  /say Show us the input you're working with, and the output that you want. Tell us where the input is coming from (disk file, terminal input, curl URL), and where you want the output to go (disk file, stdout, terminal).


index1: #bash
index2: insanity
last_referenced_in: #c-offtopic
owner: greycat
ref_user: nf!~n@monade.li
type: text
action:
  /say Insanity is taking actions which work directly against your goals. http://wooledge.org/~greg/forms-of-insanity.html


index1: #bash
index2: intersect
owner: kerframil
ref_user: nobody
type: text
action:
  /say intersect() { local x; declare -A map; while (( $# )); [[ $1 != -- ]]; do map[$1]=1; shift; done; shift; for x; do (( ++map[\$x] == 2 )) && printf '%s\n' "$x"; done }; intersect {1..10} -- {5..15}


index1: #bash
index2: ipv4
owner: Soliton
ref_user: nobody
type: text
action:
  /say isdottedquad() [[ $1 = *.*.*.* && $1 != *.*.*.*.* && .$1. != *..* && $1 != *[!.[:digit:]]* && $1 != *[1-9][0-9][0-9][0-9]* && $1 != *[3-9][0-9][0-9]* && $1 != *2[6-9][0-9]* && $1 != *25[6-9]* ]]


index1: #bash
index2: ipv4alt
owner: mknod
ref_user: nobody
type: text
action:
  /say isipv4() { [[ $1 =~ ^(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ ]]; }


index1: #bash
index2: ipv6
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say rfc5952() case :$1: in :*@(:*:*:*:*:*:*:*:|:::|::*::|[!:[:xdigit:]]|[!:][!:][!:][!:][!:])*:|*:@(0[!:]|[:0][:0]:)*) ! : ;; :*:*:*:*:*:*:*:*:) [[ :$1: != @(:*:*::*:*:|*:0:0:*) ]] ;; !(:*::*:)|*:0:0:0:@(0|*:):*) ! : ;; :*:*:*:*:*:*:*:) [[ :$1: != *:0:0:@(0|*:):* ]] ; esac


index1: #bash
index2: iqthreshold
owner: izabera
ref_user: nobody
type: text
action:
  /say izabera has been proposing over and over to set a minimum iq threshold of 60 to join #bash. please let's fucking do it already


index1: #bash
index2: isatty
owner: greycat
ref_user: nobody
type: text
action:
  /say You can see whether a file descriptor is open on a terminal with test -t. Many programs perform a check like this and change their behavior: ls, GNU grep, git, systemctl, etc.


index1: #bash
index2: izarev2
owner: izabera
ref_user: nobody
type: text
action:
  /say # d(){ dd {i,o}f="$f" conv=swab,notrunc bs=1 s{kip,eek}="$1" count="$2";};r(){ local o s i f=/dev/fd/0;(((s=${#1})%2))&&set "$1x"&&((o=s++));{ for((;i<s;i++))do d "$((i%2))" "$((s-2*(i%2)))";done;{ ((o))&&dd bs=1 count=0 skip=1;cat;}<"$f";}<<<"$1";} 2>&-; r "gip yxes a ma i"


index1: #bash
index2: j
owner: izabera
ref_user: nobody
type: text
action:
  /say https://github.com/izabera/j super slow json parser written in bash (more of a proof-of-concept)


index1: #bash
index2: jqcreate
owner: greycat
ref_user: nobody
type: text
action:
  /say To create JSON strings with variable assignments: jq -nc --arg bar "$bar" '{foo:$bar}' ;# compare with awk -v awkvar="$bashvar"


index1: #bash
index2: jqcreatelist
owner: greycat
ref_user: nobody
type: text
action:
  /say # a=("an array" "of strings"); b="a string"; printf '%s\0' "${a[@]}" | jq -RscM --arg b "$b" '{list: split("\u0000"), string: $b}'


index1: #bash
index2: keyword
owner: greycat
ref_user: nobody
type: text
action:
  /say Bash keywords (if case [[ time etc.) are part of the syntax. In some ways they act like builtin commands, but they may have completely different parsing rules. E.g. inside [[ ]] there is no word splitting or filename expansion, and > is not a redirection.


index1: #bash
index2: local
owner: geirha
ref_user: nobody
type: text
action:
  /say local [option] name[=value]. Same as using declare in a function. Define a variable as local to restrict to a function and the function's children. Good practice to prevent littering your global scope with temp vars. Less impact in an isolated script.


index1: #bash
index2: local-
owner: greycat
ref_user: nobody
type: text
action:
  /say "local -" (bash 4.4) makes all changes to shell options using "set" local to the function; they are restored when the function returns.


index1: #bash
index2: login
owner: greycat
ref_user: nobody
type: text
action:
  /say A login shell reads /etc/profile and one of ~/.bash_profile or ~/.bash_login or ~/.profile. You get a login shell by running bash with the --login (or -l) option, or by running bash with a leading - in argv[0]. The latter is the traditional way login(1) indicates that it wants a login shell.


index1: #bash
index2: ls-1
owner: greycat
ref_user: nobody
type: text
action:
  /say When ls's output is not a terminal, the -1 option is automatically enabled. If you see someone write ls -1 | ... or x=$(ls -1) or similar, you have your work cut out for you.


index1: #bash
index2: ls-t
owner: greycat
ref_user: nobody
type: text
action:
  /say You can't use ls -t in a script. Sorry. See http://mywiki.wooledge.org/ParsingLs and http://lists.gnu.org/archive/html/help-bash/2016-11/msg00033.html and !latest and !rlart for some alternatives.


index1: #bash
index2: ls2
owner: llua
ref_user: nobody
type: text
action:
  /say in coreutils >= 8.25, ls' default behavior is the same as ls --quoting-style=shell-escape -- which adds quotes around filenames with special characters. rationale: http://lists.gnu.org/archive/html/coreutils/2016-02/msg00000.html


index1: #bash
index2: lscomma
owner: sjohnson
ref_user: nobody
type: text
action:
  /say You can add commas to GNU ls' filesize output (without using -h). Does not work with POSIX or C locales: export BLOCK_SIZE="'1"; ls -l


index1: #bash
index2: lts
owner: mute
ref_user: nobody
type: text
action:
  /say Leaning toothpick syndrome is the situation in which a quoted expression becomes unreadable because it contains a large number of escape characters, usually backslashes ("\"), to avoid delimiter collision. https://en.wikipedia.org/wiki/Leaning_toothpick_syndrome


index1: #bash
index2: magicpattern
owner: ormaaj
ref_user: nobody
type: text
action:
  /say # touch {,\\}x{,\\}\[y]; ls; for x in {b,d}ash; do "$x" /dev/fd/3 "$x"; echo; done 3<<<'x=\\x* IFS=; printf "$1: "; printf "%s " $x'


index1: #bash
index2: make2
owner: kurahaupo__
ref_user: nobody
type: text
action:
  /say the shell fragments inside a makefile need to have each "$" reduplicated (as "$$") because "$" is also special to make


index1: #bash
index2: man
owner: geirha
ref_user: nobody
type: text
action:
  /say bash builtins and keywords do not have separate man-pages, read bash's manual instead or use the help builtin. Rule of thumb: If ''type foo'' says foo is a builtin or keyword, run ''help foo'' or ''man bash'', otherwise try man and/or info.


index1: #bash
index2: math
owner: greycat
ref_user: nobody
type: text
action:
  /say Add 7 to a variable: ((a+=7)) OR a=$((a+7)) OR let 'a+=7' # See http://mywiki.wooledge.org/ArithmeticExpression


index1: #bash
index2: member
owner: greycat
ref_user: nobody
type: text
action:
  /say Use an associative array to perform membership tests (including "have I already seen X"). declare -A seen; seen[$file]=1; [[ ${seen[$file]} ]] && continue


index1: #bash
index2: minirepl
owner: izabera
ref_user: nobody
type: text
action:
  /say https://gist.github.com/izabera/ac53bf9ac6d59cf89db402cb08d393a2 example to use tab completion and history with read -e


index1: #bash
index2: mre
owner: kerframil
ref_user: nobody
type: text
action:
  /say A minimal reproducible example is a small, self-contained command or script that can be executed by someone else, without modification, to concretely demonstrate the problem you are enquiring about. See !paste if it's longer than a few lines.


index1: #bash
index2: multigrep
owner: kerframil
ref_user: nobody
type: text
action:
  /say patterns=(one two ...); for f in *; do for p in "${patterns[@]}"; do [[ -f "$f" ]] && grep -q -- "$p" "$f" || continue 2; done; echo "$f"; done


index1: #bash
index2: nocaseglob
owner: geirha
ref_user: nobody
type: text
action:
  /say ''shopt -s nocaseglob'' causes filename expansion to be case-insensitive. E.g. *.jpg will match filenames ending in .JPG in addition to filenames ending in .jpg


index1: #bash
index2: noquotes
owner: nchambers
ref_user: nobody
type: text
action:
  /say https://i.imgur.com/xHmt4gr.gifv -- this could happen to you if you don't quote your expansions


index1: #bash
index2: normalmode
owner: greycat
ref_user: nobody
type: text
action:
  /say You mean command mode. Vi has "command mode" and "text input mode". Wherever you saw "normal mode" (possibly vim's documentation), it's just confusing.


index1: #bash
index2: nsfb
owner: greycat
ref_user: nobody
type: text
action:
  /say Not Safe For Bash. May induce confusion, panic, screaming, bleeding from the eyeballs, seizures, or death.


index1: #bash
index2: numglob
owner: izalove
ref_user: nobody
type: text
action:
  /say brace expansion + nullglob + the trick in !str2glob = a simple way to expand numeric ranges: shopt -s nullglob; echo @(file{12..3456})


index1: #bash
index2: ogtword
owner: ogt
ref_user: nobody
type: text
action:
  /say # seq=( $( gawk -v RS=[a-zA-Z0-9] -v ORS=' ' -v OFS= 'r += length( RT ) { R = R RT ; if ( r > 5 ) { if ( ! ( ++i % 10 ) ) exit ; else { print R; r = R = "" } } }' /dev/urandom ) ) item=${seq[SRANDOM %${#seq[@]}]} ; printf $item


index1: #bash
index2: openwrt
owner: sjohnson
ref_user: nobody
type: text
action:
  /say If your sh scripts fail when moved from OpenWRT to a Debian / Ubuntu system, rewrite them to be sh complient. e.g., stop using [[ in them.


index1: #bash
index2: options
owner: izabera
ref_user: nobody
type: text
action:
  /say http://mywiki.wooledge.org/BashFAQ/035 -- How can I handle command-line arguments (options) to my script easily?


index1: #bash
index2: oracle
owner: greycat
ref_user: nobody
type: text
action:
  /say Oracle poisoning: the fallacy popularized by Oracle (among others) that a service should be configured by an interactive shell's dot files. Symptoms include su - oracle -c 'start my database' in service scripts. No known cure.


index1: #bash
index2: ormaajloop
owner: ormaaj
ref_user: nobody
type: text
action:
  /say # alias alias='alias ' eval='eval ' n='let "(n += 1) >= max" && ' count='printf "$n "; n alias count="printf \$(( (n -= 1) + 1))\ ;" n=; eval count count'; n=0 max=15 eval count echo


index1: #bash
index2: ormaajparser
owner: ormaaj
ref_user: nobody
type: text
action:
  /say # bash -O expand_aliases -O lastpipe -c 'compgen -A keyword | while IFS= read -r x; do printf -v "BASH_ALIASES[\$x]" "echo %q " "$x"; done; eval "for x in how to write a bash parser; do :D; done"'


index1: #bash
index2: paste.ubuntu.com
owner: greycat
ref_user: nobody
type: text
action:
  /say paste.ubuntu.com is one of the worst paste sites you can possibly choose, because you must register to view the raw text.


index1: #bash
index2: patsierev
owner: Patsie
ref_user: nobody
type: text
action:
  /say # awk '{ n=split($0,a,""); while(n) printf("%c", a[n--]); printf("\n") }' <<<"Dx retaw dellitsid cihtapoemoh ekil eruP"


index1: #bash
index2: phases
last_referenced_in: bou
owner: kurahaupo_
ref_user: Bou!sid274843@user/bou
type: text
action:
  /say When reading a command, the shell first does quote and backslash removal, then $ expansions (on parts that weren't single-quoted or escaped), then wordsplitting and wildcard expansions (on parts that weren't quoted or escaped). That's why $( echo '"foo * bar"' ) does not do what you expected


index1: #bash
index2: pleasantries
owner: koala_man
ref_user: nobody
type: text
action:
  /say Hi there! How are you? Come on in, let me take your coat. Would you like a cup of tea? Ghastly weather we're having... Let's hope it clears up soon. Anyways, what can I do for you?


index1: #bash
index2: png
owner: greycat
ref_user: nobody
type: text
action:
  /say https://stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers


index1: #bash
index2: polyglot
owner: izabera
ref_user: nobody
type: text
action:
  /say i don't always shell script, but when i do, i polyglot multiple shells that i don't know. -- Riviera


index1: #bash
index2: porn6
owner: prev
ref_user: nobody
type: text
action:
  /say if pictures in some/directory/ have names pic99.jpg, pic100.jpg, pic101.jpg, pad numbers in filenames with zeros: dir='some/directory' ext=.jpg num_width=5; for f in "$dir"/*"$ext"; do [[ $f != *[[:digit:]]"$ext" ]] && continue; num=${f%"$ext"}; num=${num##*[![:digit:]]}; init=${f%"$num$ext"}; printf -v num '%0*d' "$num_width" "$((10#$num))"; mv -i -v -- "$f" "$init$num$ext"; done


index1: #bash
index2: porn7
owner: greycat
ref_user: nobody
type: text
action:
  /say porns=(p1 p2 p3 p4 p5 ...) hosts=(h1 h2 h3); n=${#hosts[@]}; i=0; for p in "${porns[@]}"; do curl "${hosts[(++i)%n]}/$p"; sleep 10; done


index1: #bash
index2: posixlet
owner: ormaaj
ref_user: nobody
type: text
action:
  /say case $(command -v let) in let) ;; *) let() { while ${2+\:} return "$((! ( ${1:-0} )))"; do shift; done; }; esac


index1: #bash
index2: prefixassignment
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say A variable assignment before a command name (without an intervening newline or semicolon) places that variable in the environment of that command, with the variable retaining its original value (if any) once the command returns. This works like "local" in a function.


index1: #bash
index2: printf
last_referenced_in: left_turn
owner: selk
ref_user: Left_Turn!~Matthew@2a00:23c8:5f85:3301:55f0:c6ef:bde2:4460
type: text
action:
  /say The printf command: ''help printf'', or http://wiki.bash-hackers.org/commands/builtin/printf?s[]=printf


index1: #bash
index2: printf-v
owner: greycat
ref_user: nobody
type: text
action:
  /say printf -v varname (bash 3.1) is like C's sprintf(). It lets you put formatted output in a variable without needing a command substitution.


index1: #bash
index2: ps0
owner: greycat
ref_user: nobody
type: text
action:
  /say Bash 4.4 introduced PS0, displayed by interactive shells after reading a complete command, just before executing it.


index1: #bash
index2: pwdenv
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say PWD is not an environment variable. The shell will ignore it if it is in the environment, and instead will extract the true value from the kernel, but it may be blocked from doing so by the permissions on parent or other ancestor directories.


index1: #bash
index2: quidproquo
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say People with decades of experience are here helping people because we get something in return: the satisfaction or "warm fuzzies" from seeing someone else's "ahah" moment when they learn something. Just asking for a fully-built solution robs us of our satisfaction, if you don't learn from it.


index1: #bash
index2: quietdebug
owner: ormaaj
ref_user: nobody
type: text
action:
  /say ( trap '{ printf -- %s\\n "$BASH_COMMAND" {BASH_XTRACEFD}>&-; } {BASH_XTRACEFD}>&"$devnull"' DEBUG {devnull}>/dev/null; set -x; : blah debug ) # xtrace with hidden printf trace in DEBUG trap


index1: #bash
index2: rabbit
owner: greycat
ref_user: nobody
type: text
action:
  /say Rabbit the Savior: an example of how NOT to write a homework question. https://mywiki.wooledge.org/BashFAQ/064/Examples


index1: #bash
index2: rand-greycat
owner: greycat
ref_user: nobody
type: text
action:
  /say rand() { local max=$((32768 / $1 * $1)); while (( (r=$RANDOM) >= max )); do :; done; r=$((r % $1)); } ## "Returns" unbiased random number from 0 to ($1-1) in global variable r.


index1: #bash
index2: rand-llua
owner: llua
ref_user: nobody
type: text
action:
  /say rand() { local max=$((32768 / $1 * $1)) r; while (( (r=$RANDOM) >= max )); do :; done; REPLY=$((r % $1)); } ## "Returns" unbiased random number from 0 to ($1-1) in global variable REPLY.


index1: #bash
index2: readline
owner: Boobuigi
ref_user: nobody
type: text
action:
  /say readline is a library to handle reading input from a terminal, e.g. for shortcuts like \c-w to wipe a word. it's developed alongside bash, configured using $INPUTRC or the bind builtin, and used in many other projects like gdb or cpython. it has both emacs and vi modes.


index1: #bash
index2: readonly
owner: Soliton
ref_user: nobody
type: text
action:
  /say Variables marked readonly (declare -r) are intended to be used with a restricted shell, to stop you from trivially changing PATH to escape the restrictions (etc.). They were never intended to be widely used in scripts. If you try, you will see odd results (-r at a global scope is passed down to local scopes).


index1: #bash
index2: redir2postit
owner: greycat
ref_user: nobody
type: text
action:
  /say The blue box has two post-it notes: "1" and "2". When you do ">>red", the red box is opened, and the note that says "1" is moved to the red box. When you do "2>&1", this means "take the note that says 2, and put it on the box that has the note that says 1". Now both "1" and "2" are on the red box.


index1: #bash
index2: retype
owner: greycat
ref_user: nobody
type: text
action:
  /say NEVER retype your failing commands into IRC. Paste them. When you retype commands you introduce even MORE errors and then we can't unravel the new errors from the old ones.


index1: #bash
index2: rhash
owner: ormaaj
ref_user: nobody
type: text
action:
  /say Recursive file hashing tool with SFV and script-friendly `--printf` output formatting http://rhash.sourceforge.net/ https://github.com/rhash/RHash


index1: #bash
index2: robust
owner: geirha
ref_user: nobody
type: text
action:
  /say http://www.davidpashley.com/articles/writing-robust-shell-scripts is complete garbage. Following its "advices" will give you the opposite of robust shell scripts.


index1: #bash
index2: roman
owner: Martin
ref_user: nobody
type: text
action:
  /say # R=ivxlcdm ; r(){ local r= i=3 j k v=$1 ; for((i=3;i>=0;--i)) do ((j=10**i, k=v/j, v%=j, i<3))&&{ ((k%5==4 )) && r+=${R:i*2:1} ; ((k>3)) && r+=${R:i*2+(k+1)/5:1} ; } ; ((k++,k%=5)) && for((;--k;))do r+=${R:i*2:1}; done done ; printf '%s ' "$r" ; } ; for p in {1..20} {21..111..3} ; do r $p ; done


index1: #bash
index2: sed-e
owner: kerframil
ref_user: nobody
type: text
action:
  /say sed -E allows for the ERE regex dialect to be used. Though not specified by POSIX.1-2008, it was accepted as an enhancement in March 2020. See also, !ere


index1: #bash
index2: seems
last_referenced_in: #c
owner: kurahaupo
ref_user: ick!~a@user/ick
type: text
action:
  /say The shell started in the 1970's, so almost any time you think "this shell feature seems like language X" it will be because X got it from the Shell, not the other way round


index1: #bash
index2: sexy
last_referenced_in: #c-offtopic
owner: sjohnson
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say date; cd; touch; unzip; strip; finger; uptime; mount; gasp; yes; yes; yes; umount; make clean; sleep


index1: #bash
index2: sigpipe
owner: greycat
ref_user: nobody
type: text
action:
  /say SIGPIPE (on Linux, signal 13, exit status 128+13 = 141) is a signal sent to a process which tries to write to a pipe that has been closed, usually because the other end has already exited. Generally harmless.


index1: #bash
index2: slashslash
owner: greycat
ref_user: nobody
type: text
action:
  /say Pathnames beginning with // may have special meaning (it's system-dependent). POSIX requires the leading // be preserved. Thus, "cd //" sets PWD to // rather than /. See <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271> and <https://unix.stackexchange.com/questions/256497/256569#256569>


index1: #bash
index2: sparse
owner: greycat
ref_user: nobody
type: text
action:
  /say Bash's indexed (non-associative) arrays can be sparse. This means they can have "holes" (gaps). E.g. a=([0]=zero [5]=five)


index1: #bash
index2: specialbuiltins
owner: izabera
ref_user: nobody
type: text
action:
  /say posix calls these builtins "special": break : . continue eval exec exit export readonly return set shift trap unset


index1: #bash
index2: sponge.c
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say /*#define N pick a number, add #includes, and ADD ERROR HANDLING */ int main(){ char*t=mktemp("/tmp/.spongeXXXXXX");int f=open(t,O_RDWR|O_CREAT|O_EXCL,0);unlink(t);ssize_t n;char b[N];while((n=read(0,b,N))>0)write(f,b,n);lseek(f,0,0);while((n=read(f,b,N))>0)write(1,b,n);}


index1: #bash
index2: sshssh
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say cmd99=( echo Hello World ) ; cmd98=( ssh -l "$remoteuser98" "$remote_host98" $( printf '%q ' "${cmd99[@]}" ) ) ; cmd97=( ssh -l "$remoteuser97" "$remote_host97" $( printf '%q ' "${cmd98[@]}" ) ) ; … repeat for as many hops as you need … ; "${cmd1[@]}"


index1: #bash
index2: stackexchange
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say StackExchange presents itself as a forum where experts answer questions. Which works for some subjects, but for others (like the Shell) the experts get out voted by novices offering half-working solutions, and eventually give up, leaving ONLY half-working solutions and other junk.


index1: #bash
index2: standard
owner: greycat
ref_user: nobody
type: text
action:
  /say input (stdin) is one of the three file descriptors (see !fd) guaranteed to all programs. Always has FD number 0. Commands may read input from it. See also: !stdout !stderr !redirtut


index1: #bash
index2: stuff
owner: greycat
ref_user: nobody
type: text
action:
  /say To stuff a string into the bash interactive line-being-edited: stuff() { local pre="${READLINE_LINE:0:$READLINE_POINT}"; local suf="${READLINE_LINE:$READLINE_POINT}"; local stuff="my string"; READLINE_LINE="${pre}$stuff$suf"; ((READLINE_POINT += ${#stuff})); }; bind -x '"\e^": stuff'


index1: #bash
index2: sudo
owner: greycat
ref_user: nobody
type: text
action:
  /say To use sudo commands in a script (without prompting for a password), put something like this into the sudoers(5) file: username ALL = NOPASSWD: /some/program


index1: #bash
index2: sudosu
owner: greycat
ref_user: nobody
type: text
action:
  /say Totally not a number puzzle. Typing "sudo su" is like typing "cat file | cat". If you want a non-login shell as root, just use "sudo -s". If you want a login shell, "sudo -i".


index1: #bash
index2: sysvinit
owner: greycat
ref_user: nobody
type: text
action:
  /say System V init is terrible. See <http://jdebp.info/FGA/unix-daemon-design-mistakes-to-avoid.html> and <https://mywiki.wooledge.org/ProcessManagement>


index1: #bash
index2: test1
owner: greycat
ref_user: nobody
type: text
action:
  /say The test command with one argument checks the string length of that argument. [ "$foo" ] is true if "$foo" is non-empty. [ false ] is true because "false" is a non-empty string.


index1: #bash
index2: today
last_referenced_in: pragma-
owner: kerframil
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say In bash >=4.2, printf -v today '%(%Y-%m-%d)T' -1 will assign the current date (in ISO-8601 format). Alternatively, use the date(1) utility: today=$(date +%Y-%m-%d).


index1: #bash
index2: toomanycooks
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say A reminder to people offering advice: if you ask the supplicant to provide information yet they seem unwilling or very slow to do so, consider that they may be overwhelmed by "help" from too many people. Give them time.


index1: #bash
index2: topic
last_referenced_in: #c-offtopic
owner: e36freak
ref_user: pragmareonelmst!~chaos@user/pragmatic-chaos
type: text
action:
  /say FAQ: http://mywiki.wooledge.org/BashFAQ | Guide: http://mywiki.wooledge.org/BashGuide | ref: http://xrl.us/bhk9ww | http://wiki.bash-hackers.org/ | USE MORE QUOTES!: http://www.grymoire.com/Unix/Quote.html | Scripts and more: http://www.shelldorado.com/ | Bug mailing list: http://tx0.org/3af | New official help mailing list: http://tx0.org/31f | Devel branch: http://xrl.us/bmodjy


index1: #bash
index2: truncate
owner: greycat
ref_user: nobody
type: text
action:
  /say You can truncate (change the length of) an existing file with truncate(1) if your OS has it, or with dd of="$file" bs="$size" seek=1 count=0


index1: #bash
index2: twkmmirror
owner: greycat
ref_user: nobody
type: text
action:
  /say mirroring the monthly tarball to <http://twkm.freeshell.org/bashwiki.tar.bz2> on the 2nd of each month.


index1: #bash
index2: unexport_all
owner: izabera
ref_user: nobody
type: text
action:
  /say remove all exports in posix sh: eval "$(awk -v q=\' 'function escape (str) { gsub(q, q "\\" q q, str); return str } BEGIN { for (i in ENVIRON) if (i ~ /^[a-zA-Z_][a-zA-Z_0-9]*$/) printf("unset %s; %s=%s\n", i, i, q escape(ENVIRON[i]) q) }')"


index1: #bash
index2: unquoted2
owner: greycat
ref_user: nobody
type: text
action:
  /say https://lists.gnu.org/archive/html/bug-bash/2017-06/msg00283.html https://lists.gnu.org/archive/html/bug-bash/2018-08/msg00047.html


index1: #bash
index2: urls
owner: greycat
ref_user: nobody
type: text
action:
  /say Print the URLs in a URL, one per line ## lynx -dump -listonly -nonumbers url ## http://wooledge.org/~greg/urls


index1: #bash
index2: user
last_referenced_in: nitrix
owner: greycat
ref_user: nitrix!~nitrix@user/meow/nitrix
type: text
action:
  /say $USER is not reliable; it's the traditional BSD variant of $LOGNAME. Use $LOGNAME instead, or ${LOGNAME:-$USER} if you want to support both flavors of historical relics.


index1: #bash
index2: varscope
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say Shell variables (exported or not) are copied whenever the a subshell is created, including momentarily before executing another program. Each process has its own variables, so a subshell cannot affect the variables of its parent, or vice versa. Variables may also be temporarily replaced within a function using "local" or by !prefixassignment


index1: #bash
index2: wait-n
owner: grummund
ref_user: nobody
type: text
action:
  /say Run up to 5 processes in parallel (bash 4.3): i=0 j=5; for elem in "${array[@]}"; do (( i++ < j )) || wait -n; my_job "$elem" & done; wait


index1: #bash
index2: wc-l
owner: greycat
ref_user: nobody
type: text
action:
  /say wc -l prints a filename if you pass it a filename as an argument. If you just want the number of lines, redirect the file as stdin instead. lines=$(wc -l < "$file")


index1: #bash
index2: where
owner: greycat
ref_user: nobody
type: text
action:
  /say To see where a variable is coming from in a login shell: PS4='+ $BASH_SOURCE:$FUNCNAME:$LINENO:' bash -ilxc : 2>&1 | grep myvar; ## or in a non-login shell, use -ixc instead of -ilxc ## This does NOT work as root. It does NOT cover variables that come from PAM, etc.


index1: #bash
index2: win32-fileio-naming-a-file
owner: aozt
ref_user: nobody
type: text
action:
  /say Often cited "win32 fileio naming-a-file" page in Microsoft documentation, recommended reading for Windows users: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file


index1: #bash
index2: win32-filename-rules
owner: aozt
ref_user: nobody
type: text
action:
  /say Rules for creation of valid names of files and directories in Windows are described here: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#file-and-directory-names


index1: #bash
index2: wsl
owner: greycat
ref_user: nobody
type: text
action:
  /say Windows Subsystem for Linux (WSL) is a misnomer; it's really "Linux Subsystem for Windows", and lets you run Linux ELF binaries on Windows. Sometimes called "Bash on Ubuntu on Windows".


index1: #bash
index2: xyz
owner: geirha
ref_user: nobody
type: text
action:
  /say "I want to do X, but I'm asking how to do Y, so I provide example Z which isn't really relevant to the problem at all."


index1: #bash
index2: zcomp
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say For tab completion with a menu interface, install https://github.com/kurahaupo/zcomp (currently in beta test; please leave feedback on GitHub)


index1: #bash
index2: {,
owner: geirha
ref_user: nobody
type: text
action:
  /say Brace and sequence expansion: {a,b,c}1 and {a..c}1 expand to a1 b1 c1, {a..c}{1..3} expands to a1 a2 a3 b1 b2 b3 c1 c2 c3. http://wiki.bash-hackers.org/syntax/expansion/brace http://mywiki.wooledge.org/BraceExpansion


index1: #bash
index2: {var}
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say Redirections prefaced by {var} allocate a spare filedescriptor and assign its number to the variable. Note that they apply to the whole shell, not just to the command, similar to other redirections on exec. To prevent confusion, we recommend only using the {var}< and {var}> redirections on the "exec", to make it clear that they persist in the shell beyond the command they appear in.


index1: #bash
index2: |read
owner: kurahaupo
ref_user: nobody
type: text
action:
  /say « read < <( prog ) » is preferable to « prog | read » in almost all circumstances, because the latter implicitly puts « read » into subshell, so whatever it reads is immediately forgotten.


index1: #bash
index2: }
owner: greycat
ref_user: nobody
type: text
action:
  /say } is not a keyword or shell metacharacter. It only terminates a command group when it's the first word in a new line/command. In a one-liner, use { a; } not { a }


index1: #bash
index2: ~
last_referenced_in: #c-offtopic
owner: yitz
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say http://bash-hackers.org/wiki/doku.php/syntax/expansion/tilde $HOME may be easier to use inside ""s as ~ won't expand when double quoted.


index1: #c-offtopic
index2: nix-build
last_referenced_in: #c-offtopic
owner: nf!~n@monade.li
ref_user: nf!~n@monade.li
type: text
action:
  /call bash IFS= read -r expr; nix-build --expr "let pkgs = import <nixpkgs> {}; inherit (pkgs) lib; in $expr" -stdin


index1: #c-offtopic
index2: nix
edited_by: nf!~n@monade.li
last_referenced_in: #c-offtopic
owner: nf!~n@monade.li
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
usage: Usage: nix [args] <command>
action:
  /call bash IFS= read -r expr; nix-instantiate --eval --strict -E "let pkgs = import <nixpkgs> {}; inherit (pkgs) lib; in $expr" -stdin


index1: #c-offtopic
index2: simnitrix
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: nitrix!~nitrix@user/nitrix
type: text
action:
  /say My sim would probably look like "<foo>, but <bar>." with absurd claims where I appear confident.


index1: .*
index2: normal_flavor
edited_by: pragma-!~chaos@user/pragmatic-chaos
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: nobody
type: text
action:
  yummy delicious sublime piquant delectable $colors stochastic smokey coal-fired hoppy smooth creamy dark perfect precise earthy soft excellent acceptable comestible


index1: #c
index2: sizeof(char)
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: sham1!~sham1@212-146-44-107.aboa.net
type: text
action:
  /say The size of `char` is always 1, by definition. Multiplying by `sizeof (char)` adds no value and makes the code noisier.


index1: #c-offtopic
index2: unlimited_nf_works
last_referenced_in: #c-offtopic
owner: nf!~n@monade.li
ref_user: nf!~n@monade.li
type: text
action:
  [2m36s ago] <edk> i am the nf of my daughter
  [2m27s ago] <edk> monads are my body and applicative functors are my blood
  [2m3s ago] <edk> i have created over a thousand profunctors
  [1m30s ago] <edk> unknown to star trek
  [1m5s ago] <edk> nor known to... uh... k
  [48s ago] <edk> have withstood Pain to create many Eggs
  [30s ago] <edk> yet those Baguettes will never hold Anything
  [22s ago] <edk> so, as i pray --
  [19s ago] <edk> unlimited nf works


index1: #c-offtopic
index2: isprimenf
last_referenced_in: #c-offtopic
owner: nf!~n@monade.li
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call hs (\ n -> let x `elem` xs = head (dropWhile (< x) xs) == x; sieve (n:ns) = n:filter ((/= 0) . (`mod` n)) (sieve ns); primes = sieve [2..] in putStrLn $ show n ++ " is " ++ (if n `elem` primes then "" else "not " ) ++ "a prime." )


index1: .*
index2: isprime
edited_by: zalt!~zalt@user/zalt
last_referenced_in: #c-offtopic
owner: zalt!~zalt@user/zalt
ref_user: floatcomplex!~floatcomp@wireguard/tunneler/floatcomplex
type: text
action:
  /code python3
  import functools, sys, math
  def evaluated_int():
      try:
          return int(eval("$args"))
      except:
          print('Usage: ,isprime [integer]')
          sys.exit(1)
  n = evaluated_int()
  p = int(n != 1)
  for i in range(2, int(math.sqrt(n))+1):
      if n % i == 0:
          p = 0
          break
  print('{} is {}a prime.' .format(n,  ['not ' ,'' ][p]))


index1: #c
index2: -->
edited_by: pragma-!~chaos@user/pragmatic-chaos
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say `int i = 5; while (i --> 0) ...;` is jokingly read as "while `i` goes towards zero" . The goes-towards operator, `-->`, does not actually exist; it is a "clever" omission of whitespace.


index1: #c
index2: pm
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say Private conversations with a single individual means you're subject to that individual's knowledge which may or may not be correct. Public conversations in the channel allows everyone a chance to correct misspoken or incorrect info.


index1: #pbot
index2: hs
last_referenced_in: #pbot
owner: nf!~n@monade.li
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call bash { echo ':m Prelude Control.Applicative Control.Arrow Control.Monad Data.Bifunctor Data.Bool Data.Char Data.Complex Data.Either Data.Foldable Data.Function Data.Functor Data.List Data.Maybe Data.Monoid Data.Ratio Data.Semigroup Data.String Data.Traversable Data.Tuple Data.Void System.IO System.Exit System.Environment System.Random Text.Read'; cat; } | ghci -XArrows -XBangPatterns -XBinaryLiterals -XBlockArguments -XConstraintKinds -XDataKinds -XDeriveTraversable -XDerivingVia -XEmptyCase -XEmptyDataDecls -XFlexibleContexts -XFlexibleInstances -XGADTs -XGeneralisedNewtypeDeriving -XLambdaCase -XLiberalTypeSynonyms -XMonadComprehensions -XMultiWayIf -XNamedFieldPuns -XNumericUnderscores -XOverloadedStrings -XPatternSynonyms -XPolyKinds -XRankNTypes -XRecordWildCards -XRecursiveDo -XScopedTypeVariables -XStandaloneDeriving -XTupleSections -XTypeApplications -XTypeOperators -XUnicodeSyntax -XViewPatterns -v0 -fprint-explicit-foralls -stdin


index1: #c
index2: test
last_referenced_in: #c
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /say puts("\
  \
  \"All right,\" said Susan. \"I'm not stupid. You're saying humans need... fantasies to make life bearable.\"\n\
  \n\
  REALLY? AS IF IT WAS SOME KIND OF PINK PILL? NO. HUMANS NEED FANTASY TO BE HUMAN. TO BE THE PLACE WHERE THE FALLING ANGEL MEETS THE RISING APE.\n\
  \n\
  \"Tooth fairies? Hogfathers? Little—\"\n\
  \n\
  YES. AS PRACTICE. YOU HAVE TO START OUT LEARNING TO BELIEVE THE LITTLE LIES.\n\
  \n\
  \"So we can believe the big ones?\"\n\
  \n\
  YES. JUSTICE. MERCY. DUTY. THAT SORT OF THING.\n\
  \n\
  \"They're not the same at all!\"\n\
  \n\
  YOU THINK SO? THEN TAKE THE UNIVERSE AND GRIND IT DOWN TO THE FINEST POWDER AND SIEVE IT THROUGH THE FINEST SIEVE AND THEN SHOW ME ONE ATOM OF JUSTICE, ONE MOLECULE OF MERCY. AND YET—Death waved a hand. AND YET YOU ACT AS IF THERE IS SOME IDEAL ORDER IN THE WORLD, AS IF THERE IS SOME...SOME RIGHTNESS IN THE UNIVERSE BY WHICH IT MAY BE JUDGED.\n\
  \n\
  \"Yes, but people have got to believe that, or what's the point—\"\n\
  \n\
  MY POINT EXACTLY.\"\n");


index1: .*
index2: pb
last_referenced_in: #c-offtopic
owner: siesta!~siesta@srv24711.blue.kundencontroller.de
ref_user: Bou!sid274843@user/bou
type: text
action:
  /code c11

  #define mx 256 \n
  #define px 256 \n
  #define sx 256 \n
  #define gx 256 \n
  #define ux 256 \n

  void error(size_t ep,const char *fmt,...) {
    va_list args;
    printf("Error: %zu: ",ep);
    va_start(args,fmt);
    vprintf(fmt,args);
    va_end(args);
    exit(1);
  }

  int main(int argc,char **argv) {

    if(argc<2) {
      printf("Syntax: pb \"code\" \"input\"\n");
      return 1;
    }

    char g[gx],u[ux];
    char *c=NULL;
    unsigned char m[mx]={0};
    size_t s[sx],cp=0,mp=0,sp=0,gp=0,gn=0,up=0,ep=0,cn=0;
    ssize_t p[px],d=0;

    c=argv[1];
    cn=strlen(c);

    if(argc==3) {
      strcpy(g,argv[2]);
      gn=strlen(g);
    }

    for(int i=0;i<px;i++) p[i]=-1;

    while(cp<cn) {

      switch(c[cp]) {
      case '.': 
        putchar(m[mp]); 
        break;
      case ',':
        m[mp]=(unsigned char)(gp==gn?0:g[gp++]); 
        break;
      case '+': 
        m[mp]++; 
        break;
      case '-':
        m[mp]--; 
        break;
      case '>':
        if(mp==mx-1) error(cp,"memory overflow"); else mp++; break;
      case '<':
        if(mp==0) error(cp,"memory underflow"); else mp--; break;
      case '[':
        ep=cp; 
        if(!m[mp]) {
          d=1;
          while(cp<cn && d) {
            if(cp==cn-1) error(ep,"unbalanced [");          
            cp++;
            d+=(c[cp]=='[')-(c[cp]==']');
          }
        }
        break;
      case ']':
        ep=cp;
        if(m[mp]) {
          d=1;
          while(cp>0 && d) {
            if(cp==0) error(ep,"unbalanced ]");
            cp--;
            d-=(c[cp]=='[')-(c[cp]==']');
          }
        }
        break;
      case '(':
        ep=cp;
        p[m[mp]]=cp;
        d=1;
        while(cp<cn && d) {
          if(cp==cn-1) error(ep,"unbalanced (");          
          cp++;
          d+=(c[cp]=='(')-(c[cp]==')');
        }      
        break;
      case ')':
        if(sp==0) error(cp,"stack underflow");
        cp=s[--sp];
        break;
      case ':': 
        if(sp==sx) error(cp,"stack overflow");
        s[sp++]=cp;
        if(p[m[mp]]==-1) error(cp,"undefined procedure %u",m[mp]);
        cp=p[m[mp]];
        break;
      }
      cp++;
    }
    return 0;
  }


index1: .*
index2: sin
last_referenced_in: #c-offtopic
owner: siesta!~siesta@srv24711.blue.kundencontroller.de
ref_user: Bou!sid274843@user/bou
type: text
action:
  /code c11
  srand(time(NULL));
  printf("%s",(char*[]){"Pride","Greed","Lust","Envy","Gluttony","Wrath","Sloth"}[rand()%7]);


index1: #c
index2: malloccasting
last_referenced_in: #c
owner: NRK!~nrk@2001:470:69fc:105::4e30
ref_user: NRK!~nrk@2001:470:69fc:105::4e30
type: text
action:
  https://github.com/cat-milk/Anime-Girls-Holding-Programming-Books/raw/master/Memes/Himegoto_Casting_Malloc.png


index1: #c-offtopic
index2: cool
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c
owner: NRK!~nrk@2001:470:69fc:105::4e30
ref_user: fdnick!~user@2001:16b8:1841:1400:22d3:85cf:8e6e:306a
type: text
action:
  /call echo &{ucfirst &{maybe-the $args}} %(is %(%( | not) allowed into | thrown out of) | drinks coolaids inside) the cool club.


index1: #c-offtopic
index2: nightnights
owner: Ckat!~Ckat@xn--z7x.xn--6frz82g
ref_user: nobody
type: text
action:
  "good night" nn "guten nacht" "sleep well" "bye" "cya" "nighty night" "night!" "see you later" "have a good one"


index1: #c
index2: has_attr
last_referenced_in: #c-offtopic
owner: NRK!~nrk@2001:470:69fc:105::4e30
ref_user: NRK!~nrk@2001:470:69fc:105::4e30
type: text
action:
  /say portably using compiler attributes: https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html


index1: #c-offtopic
index2: snipe
last_referenced_in: #c
owner: NRK!~nrk@2001:470:69fc:105::4e30
ref_user: NRK!~nrk@2001:470:69fc:105::4e30
type: text
action:
  /call me $weapon_action her sniper rifle and $shoot_action &{maybe-the $args}'s $body_part. ( ´-ω･)︻┻┳══━一


index1: #c-offtopic
index2: campenings
edited_by: Ckat!~Ckat@xn--z7x.xn--6frz82g
owner: Ckat!~Ckat@xn--z7x.xn--6frz82g
ref_user: nobody
type: text
action:
  "You set up $0 $rpg_location." "You attempt to set up $0 but $rpg_trap_death! You are dead. R.I.P." "You have a $flavor time $0ing. $rpg_sceneries" "You set up $0. Your tent is invaded by an $animal_adjectives $animal_types! You feel $rpg_health."


index1: .*
index2: cstd
action: cstd.pl
last_referenced_in: pragma-
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: applet
usage:
  Usage: cstd [-std=C99|C11|C23] [-list] [-n#] [-section <section>] [search text/section-paragraph] [-text <regex>] (Use the `c99`, `c11` and `c23` commands to avoid needing to use the `-std=` option.)


index1: #c
index2: atomics
edited_by: nitrix!~nitrix@user/nitrix
last_referenced_in: nitrix
owner: nitrix!~nitrix@user/nitrix
ref_user: nitrix!~nitrix@user/meow/nitrix
type: text
action:
  /call echo C11 introduced memory orderings and atomic operations. This should help approach the subject: https://gist.github.com/nitrix/19bab7c711d05811a4661a189d26bc19


index1: #c-offtopic
index2: currencies
edited_by: Ckat!~Ckat@xn--z7x.xn--6frz82g
owner: Ckat!~Ckat@xn--z7x.xn--6frz82g
ref_user: nobody
type: text
action:
  lira dollar euro yen yuan peso "bottle caps" weed ruble taka dinar rupee franc shekel pound krona shilling kwacha


index1: #c
index2: charter
last_referenced_in: #c
owner: nitrix!~nitrix@user/nitrix
ref_user: nitrix!~nitrix@user/meow/nitrix
type: text
action:
  /call echo The latest C23 Charter (Original principles + C99 + C11 + C23): https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2611.htm


index1: #c
index2: dontcast
edited_by: nitrix!~nitrix@user/nitrix
last_referenced_in: ski
owner: nitrix!~nitrix@user/nitrix
ref_user: ski!~ski@remote11.chalmers.se
type: text
action:
  /say Casts are explicit and forceful conversions. In general, all conversions that are safe can be performed without the cast operator (though sometimes requiring the help of a temporary variable). It's advisable for everyone to stay away from casts as they disable diagnostics and will often hide serious problems. Inline arithmetic, bogus APIs, const incorrectness and old code trying to be generic are perhaps the few legitimate uses left.


index1: #c
index2: mallocsize
last_referenced_in: nitrix
owner: kurahaupo!~kurahaupo@211.30.37.170
ref_user: nitrix!~nitrix@user/nitrix
type: text
action:
  p = malloc(n*sizeof *p) is more robust than p = malloc(n*sizeof (T)) because sizeof *p will always be the correct size without needing to confirm a previous declaration of T *p;


index1: #c-offtopic
index2: donderdag
last_referenced_in: #c-offtopic
owner: spookynumbers!~floatcomp@wireguard/tunneler/floatcomplex
ref_user: spookynumbers!~floatcomp@wireguard/tunneler/floatcomplex
type: text
action:
  /call bash TZ=CET date +'%u %H' | awk '{ t = ($1 * 24 + $2 + 72) % 168; printf "het is %s\n", (t < 9 ? "daar donderdag" : t < 24 ? "donderdag, mijn heren. donderdag!" : t < 33 ? "hier nog donderdag" : t >= 160 ? "bijna donderdag" : "nog geen donderdag") }'


index1: #c
index2: hide
last_referenced_in: #c-offtopic
owner: kurahaupo!~kurahaupo@211.30.140.189
ref_user: nitrix!~nitrix@user/nitrix
type: text
action:
  /say The ops in this channel don't normally show +o all the time; rather they ask chanserv to grant them +o when they need it. (But even that is unusual, as I can perform most "op" tasks upon request.)


index1: #c-offtopic
index2: pragma-immortal
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say <pragma-> am i ever going to actually die? or am i going to keep surviving as my consciousness keeps travelling to universes where the outcome of a 50/50 of life/death is life


index1: #c
index2: rps_c
last_referenced_in: #c-offtopic
owner: siesta!~siesta@srv24711.blue.kundencontroller.de
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /code c11 int n=strlen(argv[1]),w=0,l=0,d=0;char h,c,s[n+1];srand(time(NULL));for(int i=0;i<n;i++){h=tolower(argv[1][i]);c=s[i]="rps"[rand()%3];if(h==c) d++; else if((h=='r'&&c=='s')||(h=='p'&&c=='r')||(h=='s'&&c=='p')) {argv[1][i]=toupper(h);w++;} else {s[i]=toupper(s[i]);l++;}} s[n]='\0';printf("you: %s cpu: %s w:%d l:%d d:%d luck:%0.2lf" ,argv[1],s,w,l,d,(double)(w-l)/(w+l)*100);


index1: #c
index2: cstdtohtml
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: nobody
type: text
action:
  /say https://github.com/cigix/cstdtohtml | https://github.com/pragma-/pbot/blob/master/applets/gencstd.pl


index1: #c
index2: innerfam
last_referenced_in: #c
owner: nitrix!~nitrix@user/nitrix
ref_user: nitrix!~nitrix@user/nitrix
type: text
action:
  struct thing { size_t header; char c; char fam[]; }; printf("%zu < %zu" , offsetof(struct thing, fam), sizeof (struct thing));


index1: #c
index2: sprong
last_referenced_in: #c
owner: NRK!~nrk@2001:470:69fc:105::4e30
ref_user: NRK!~nrk@2001:470:69fc:105::4e30
type: text
action:
  /say The sprong operator `[0]->` is a hidden secret operator that makes two star programming easier. The first time you see a[0]->b[0]->c it looks a bit strange, but once you've got over the initial shock, it's really a big improvement. http://textmail.net/sprong/sprong.html


index1: #c-offtopic
index2: aminalvs
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call perl @aminals = qw/&{aminal-list} &{aminal-list}/; print "$aminals[0] vs $aminals[1] -- FIGHT! ... Winner: " , $aminals[rand @aminals], "!"


index1: #c-offtopic
index2: aminal-list
edited_by: JAA!~JAA@user/jaa
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call echo %(🐀|🐁|🐂|🐃|🐄|🐅|🐆|🐇|🐈|🐉|🐊|🐋|🐌|🐍|🐎|🐏|🐐|🐑|🐒|🐓|🐔|🐕|🐖|🐗|🐘|🐙|🪳|🐛|🐜|🐝|🐞|🐟|🐠|🐡|🐢|🐣|🐤|🐥|🐦|🐧|🐨|🐩|🐪|🐫|🐬|🐭|🐮|🐯|🐰|🐱|🐲|🐳|🐴|🐵|🐶|🐷|🐸|🐹|🐺|🐻|🐼|🦟|🦩|🦑|🕷|🦂|🪱|🦠|🐌|🦈|🦭|🦖|🦕|🦜|🦚|🦤|🦉|🦢|🦆|🦅|🕊️|🦃|🦡|🦘|🦨|🦦|🦥|🦇|🦔|🦫|🦛|🦏|🦣|🦒|🦙|🦬|🦌|🦓|🦄|🐿️|🐻‍❄️|🦍|🦎|🦌|🦋|🦊|🦞|🦝|🦧|🦐|🦀|🦗|🦁|🪰|🪲|🫎|🫏|🪿|🪼|🐦‍🔥)


index1: #c
index2: sanitizers
edited_by: nitrix!~nitrix@user/meow/nitrix
last_referenced_in: #c
owner: pekster!~rewt@user/pekster
ref_user: pekster!~rewt@user/pekster
type: text
action:
  /say Building with sanitizers adds runtime instrumentation to detect bugs in your code; to get started, build with options `-fsanitize=address,undefined -Og -g3` & run the resulting binary. Checks occur during program execution.


index1: #c-offtopic
index2: tagteam-aminalvs
last_referenced_in: #c-offtopic
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call perl @aminals = qw/&{aminal-list}&{aminal-list} &{aminal-list}&{aminal-list}/; print "$aminals[0] vs $aminals[1] -- FIGHT! ... Winner: " , $aminals[rand @aminals], "!"


index1: #c
index2: license
edited_by: nitrix!~nitrix@user/meow/nitrix
owner: nitrix!~nitrix@user/meow/nitrix
ref_user: nobody
type: text
action:
  /say THE HELP IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.


index1: #c
index2: JIT
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: nobody
type: text
action:
  https://github.com/spencertipping/jit-tutorial | https://eli.thegreenplace.net/2013/11/05/how-to-jit-an-introduction | https://eli.thegreenplace.net/2017/adventures-in-jit-compilation-part-2-an-x64-jit/ | https://nullprogram.com/blog/2015/03/19/


index1: .*
index2: you've
edited_by: pragma-!~chaos@user/pragmatic-chaos
last_referenced_in: #wordle
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /code perl no warnings; $_s = lc "@ARGV" ; $_s =~ s/[[:punct:]]+$//; $_n = quotemeta "$nick" ; $_s =~ s/\bmy\b/xbyourxb/gi; $_s =~ s/\bmyself\b/xbyourselfxb/gi; $_s =~ s/\bme\b|\bi\b/xbyouxb/gi; $_s =~ s/(\W|^)$_n\'s(\W|$)/$1xbyourxb$2/gi; $_s =~ s/(\W|^)$_n(\W|$)/$1xbyouxb$2/gi; $_s =~ s/\byour\b/my/gi; $_s =~ s/\byourself\b/myself/gi; $_s =~ s/\byou\b/I/gi; $_s =~ s/xb(\w+)xb/$1/g; if ($_s =~ /(.*?)(?:(?:\s+and|[[:punct:]])\s+.*)?$/i) { print "/call say $nick: I have $1? $reaction" ; }


index1: #wordle
index2: spray
last_referenced_in: #wordle
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: JAA!~JAA@user/meow/JAA
type: text
action:
  /call func sed s/Le.*?:.*?@//g Le:&{wordle start}@&{wordle guess %(aster|rates|stare|tares|taser|tears|treas)}@&{wordle guess blink}@&{wordle guess %(chomp|whomp|mowch)}@&{wordle guess fudgy}


index1: #wordle
index2: jaatest
edited_by: emanuele6!~emanuele6@user/emanuele6
last_referenced_in: #wordle
owner: emanuele6!~emanuele6@user/emanuele6
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call call &{code sh x='&{wordle show}' ; if [[ $x != *'n''o Wordle yet'* && $(<<< "$x" perl -pe 's/ Letters:.*//; s/ [A-Z]//g; s/[^ *?]//g' ) = *[!*]* ]] then echo plural; else echo d; fi} $args


index1: #wordle
index2: rw
last_referenced_in: #wordle
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /code sh _len="${1:-5}" ; _list="${2:-american}" ; grep -P ^.{$_len}$ /usr/share/dict/$_list | shuf -n 1


index1: #wordle
index2: rspray
last_referenced_in: #wordle
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: pragma-!~chaos@user/pragmatic-chaos
type: text
action:
  /call func sed s/Le.*?:.*?@//g Le:&{wordle start}@&{wordle guess &{rw}}@&{wordle guess &{rw}}@&{wordle guess &{rw}}@&{wordle guess &{rw}}


index1: #wordle
index2: jaaspray
last_referenced_in: #wordle
owner: emanuele6!~emanuele6@user/emanuele6
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call call &{code sh _x='&{wordle show}' ; if [[ $_x != *'n''o Wordle yet'* && $(<<< "$_x" perl -pe 's/ Letters:.*//; s/ [A-Z]//g; s/[^ *?]//g' ) = *[!*]* ]] then echo rs; else echo s; fi}pray


index1: #wordle
index2: megaspray
edited_by: emanuele6!~emanuele6@user/emanuele6
last_referenced_in: #wordle
owner: emanuele6!~emanuele6@user/emanuele6
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call code sh shopt -s extglob; _x='&{rspray}@&{rspray}@&{wordle guess &{rw}}@&{wordle guess &{rw}}@' _x="${_x//Letters+([!@])@}" _y='&{wordle letters}' _y=${_y/Letters/l} _y=$(sed <<<$_y 's/\([[:upper:]] \)\{0,1\} */\1/g' ); sed <<<$_x$_y 's/ *\([[:upper:]]\)[^ ?*]*[ ?*]/\1/g; s/^  *//; s/  *$/ \\x0F/; s/  */ /;y/l/L/' | {func sed s/\\x0F/\x0f/g}


index1: #wordle
index2: megasolve
edited_by: JAA!~JAA@user/meow/JAA
last_referenced_in: #wordle
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: Jupelius!jupelius@itu.ihme.org
type: text
action:
  /call code sh _x='&{code sh _l='&{wordle info}' _l="${_l#*(}" _l="${_l%%)*}";for((_i=0;_i<50/_l;++_i));do printf '\&{wordle guess \&{sw}}@';done}';shopt -s extglob;_x="${_x//Letters+([!@])@}" _x="${_x%%Wordle already solved.*}" _y='&{wordle letters}' _y=${_y/Letters/l} _y=$(sed <<<$_y 's/\([[:upper:]] \)\{0,1\} */\1/g' ); sed <<<$_x$_y 's/ *\([[:upper:]]\)[^ ?*[:lower:]]*[ ?*]/\1/g; s/^  *//; s/  *$/ \\x0F/; s/  */ /; y/l/L/; s/! *@L.*/!/' | {sed s/\\x0F/\x0f/g}


index1: #wordle
index2: sspray
edited_by: JAA!~JAA@user/meow/JAA
last_referenced_in: #wordle
owner: pragma-!~chaos@user/pragmatic-chaos
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call func sed s/Le.*?:.*?@//g &{wordle guess &{sw}}@&{wordle guess &{sw}}@&{wordle guess &{sw}}@&{wordle guess &{sw}}


index1: #wordle
index2: sw
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: Jupelius!jupelius@itu.ihme.org
type: text
action:
  /call code sh [[ '&{wordle info}' =~ ^Current\ wordlist:\ ([a-z-]+)\ \(([0-9]+)\) ]]; _l='&{wordle letters} ' _l="${_l#*:}" _r="${_l//[[:upper:]] }" _r="${_r//[^[:upper:]]}" _p=^; for ((_i=0;_i<${#_r};++_i));do _p+="(?=.*${_r:_i:1})" ;done; _p+="[${_l//[^[:upper:]]}]{${BASH_REMATCH[2]}}$" ; grep -Pi "$_p" "/usr/share/dict/${BASH_REMATCH[1]}" | shuf -n 1


index1: #wordle
index2: jaasolve-state2pattern
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: JAA!~JAA@user/meow/JAA
type: text
action:
  /call code sh bash -c '_s=$1.;_t=${_s%%.*} _l=${#_t};declare -A _o _e _m _n;declare -a _p;while [[ "$_s" ]];do _g=${_s%%.*} _s=${_s#*.} _r=${_s%%.*} _s=${_s#*.};((${#_g}!=${#_r}||${#_g}!=_l))&&exit 1;_n=();for((_i=0;_i<_l;++_i));do _c=${_g:_i:1} _d=${_r:_i:1};case $_d in G)_p[_i]=$_c;;&Y)[[ ${_p[_i]} == [^^]* ]]||_p[_i]=${_p[_i]:-^}$_c;&G|Y)((_n[$_c]+=1));;B)_m[$_c]=1;;esac;done;for _c in ${!_n[@]};do ((_n[$_c]>_o[$_c]))&&_o[$_c]=${_n[$_c]};done;for _c in ${!_m[@]};do ((_o[$_c]))&&_e[$_c]=${_o[$_c]};done;for _c in ${!_m[@]};do ((_o[$_c]))&&unset -v _m[$_c];done;_f=^;((${#_m[@]}))&&_f+="(?!.*[$(printf %s ${!_m[@]})])";((${#_o[@]}))&&for _c in ${!_o[@]};do _f+=\(?=;for((_i=0;_i<_o[$_c];++_i));do _f+=.*$_c;done;_f+=\);done;((${#_e[@]}))&&for _c in ${!_e[@]};do _f+=\(?!;for((_i=0;_i<_e[$_c]+1;++_i));do _f+=.*$_c;done;_f+=\);done;for((_i=0;_i<_l;++_i));do _q=${_p[_i]};[[ "$_q" == ^* ]]&&_f+=[$_q]||_f+=${_q:-.};done;_f+=\$;done;echo "$_f"' _


index1: #wordle
index2: jaasolve-guessrepr
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call code sh _w='&{wordle show}' _w="${_w%Le*}" _w="${_w//[^[:upper:] ?*]}" _w="${_w//ẞ/ß}" _g= _r=; for((_i=1;_i<${#_w};_i+=3));do _t=${_w:_i:1} _g+=${_t,,} _t=${_w:_i+1:1} _t=${_t/\?/Y} _t=${_t/\*/G} _t=${_t/ /B} _r+=$_t;done; echo $_g.$_r


index1: #wordle
index2: jaasolve-solver
edited_by: JAA!~JAA@user/meow/JAA
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call code sh bash -c '[[ "$1" == *.+(G) ]] && exit; [[ "&{wordle info}" =~ ^Current\ wordlist:\ ([a-z-]+)\ \(([0-9]+)\) ]];  _p="'\''&""{jaasolve-state2pattern $1}'\''";[[ "$1" ]]||{ _p=^;for((_i=0;_i<${BASH_REMATCH[2]};++_i));do _p+=.;done;_p+="\$";}; printf %s "&""{wordle guess &""{code sh grep -Pi $_p /usr/share/dict/${BASH_REMATCH[1]} | shuf -n 1}}@" "&""{jaasolve-solver ${1:+"$1."}&""{jaasolve-guessrepr}}"' _


index1: #wordle
index2: jaasolve
edited_by: emanuele6!~emanuele6@user/emanuele6
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call code sh shopt -s extglob; _o='&{jaasolve-solver}' _o="${_o//Let+([!@])@}" _o="${_o%@*}"; sed <<<"$_o" 's/ *\([[:upper:]]\)[^ ?*[:lower:]]*[ ?*]/\1/g; s/^  *//; s/  *$/ \\x0F/; s/  */ /' | {func sed s/\\x0F/\x0f/g}


index1: .*
index2: rice
last_referenced_in: #c-offtopic
owner: emanuele6!~emanuele6@user/emanuele6
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  Originario Basmati Arborio Gobindobhog Maratelli Tulaipanji Molakolukulu Jasmine Jasmati Carnaroli Ribe


index1: .*
index2: loooong
edited_by: emanuele6!~emanuele6@user/emanuele6
last_referenced_in: #wordle
owner: bsahbot!emanuele6@freeshell.org
ref_user: JAA!~JAA@user/meow/JAA
type: text
action:
  /say ........................................................................................................................................................................................................................................................................................................................................................................................................................................................


index1: #wordle
index2: jaa-recall2state-inner
edited_by: JAA!~JAA@user/meow/JAA
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: JAA!~JAA@user/meow/JAA
type: text
action:
  /code sh shopt -s extglob; _w=" ${1//ẞ/ß} ["; while [[ "$_w" == *@(already|Legend)* ]]; do _t="${_w#*@(already|Legend)}"; [[ "$_t" == *' ['* ]] || _t=; _w="${_w%"$_t"}" _w="${_w% \[*} [${_t#* \[}"; done; _w="${_w% \[}" _t=${_w##*Correct}; [[ "$_t" != "$_w" ]] && if [[ "$_t" == *Let* ]]; then _w=$_t; _w="[${_w#* \[}"; else _w=${_w% \[*} _w=${_w##*Correct*([^[])}; fi; for ((_i = ${2:-0}; _i > 0; --_i)); do _w="${_w% \[*}"; done; _w="${_w##+( )}" _w="${_w%%+( \[)}" _o=; while [[ "$_w" =~ ^\[[0-9a-z]+\ ago\]\ \<candide\>\ ([^\[]+)(.*)$ ]]; do _w="${BASH_REMATCH[2]}" ; _x="${BASH_REMATCH[1]%Le*}" _x="${_x//[^[:upper:] ?*]}" ; _g= _r=; for((_i=1;_i<${#_x};_i+=3));do _t=${_x:_i:1} _g+=${_t,,} _t=${_x:_i+1:1} _t=${_t/\?/Y} _t=${_t/\*/G} _t=${_t/ /B} _r+=$_t;done; _o=$_o${_o:+.}$_g.$_r; done; printf %s\\n "$_o"


index1: #wordle
index2: wsr
edited_by: emanuele6!~emanuele6@user/emanuele6
last_referenced_in: #wordle
owner: emanuele6!~emanuele6@user/emanuele6
ref_user: emanuele6!~emanuele6@user/emanuele6
type: text
action:
  /call wsg &{code sh (( $arglen )) && set -- $args; _n=${1-5} _lang=${2-american}; echo '&'"{rw $_n $_lang}"} $arg[1]


index1: #wordle
index2: jaa-guesses2state
edited_by: JAA!~JAA@user/meow/JAA
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: JAA!~JAA@user/meow/JAA
type: text
action:
  /code sh shopt -s extglob; declare -A _m=(\* G \? Y \  B);_w=" ${1//ẞ/ß}" _w=${_w,,} _o=; while [[ "${_w}" ]]; do _g= _r= _w=${_w:1}; while [[ "${_w}" == ' '?[\ ?*]* ]]; do _g+=${_w:1:1} _r+=${_m["${_w:2:1}"]} _w=${_w:3}; done; _o=$_o${_o:+.}$_g.$_r; done; _o=${_o%.+([^.]).+(G)}; for ((_i = ${2:-0}; _i > 0; --_i)); do _o=${_o%.+([^.]).+([GYB])}; done; printf %s\\n "$_o"


index1: #wordle
index2: jaa-guesses2wordles
edited_by: JAA!~JAA@user/meow/JAA
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: JAA!~JAA@user/meow/JAA
type: text
action:
  /call wordles &{jaasolve-state2pattern &{jaa-guesses2state '&{wordle guesses | {stripircformatting}}' $arg[-1]}} &{wordle info | {sed s/ \(.*$//} | {sed s/^.* //}}


index1: #wordle
index2: jaa-guesses2wordlesc
edited_by: JAA!~JAA@user/meow/JAA
last_referenced_in: #wordle
owner: JAA!~JAA@user/meow/JAA
ref_user: JAA!~JAA@user/meow/JAA
type: text
action:
  /call wordlesc &{jaasolve-state2pattern &{jaa-guesses2state '&{wordle guesses | {stripircformatting}}' $arg[-1]}} &{wordle info | {sed s/ \(.*$//} | {sed s/^.* //}}


