General Programming |
Author |
Message |
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Jun 23, 2006 9:20 pm Post subject: C Code, C++ Code, Portability & Experience |
|
|
At JoS: Code Portability between C and C++
"Do you know if C is a more portable language than C++
Where it's about the same level of difficulty ?"
Last edited by delovski on Wed Sep 13, 2006 5:57 pm; edited 1 time in total |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Jun 23, 2006 9:24 pm Post subject: |
|
|
Parity Check: C++ - The Forgotten Trojan Horse
"What makes C++ so fascinating is that it first emerges as a helper, but
with enough encouragement, its transformed into the conqueror and
eventually the new master to which all must yield." |
|
Back to top |
|
|
C Plus Guest
|
Posted: Fri Sep 08, 2006 4:57 pm Post subject: |
|
|
Mind Games and the lovely syntax of C: Const pointers: Logical consequences
"Isn't that a pointer to a const PROPSHEETHEADER? The pointer itself is
not const." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Sep 11, 2006 9:02 pm Post subject: |
|
|
GameArchitect.net - Why C++,
By Kyle Wilson
"More powerful? Every C game I've seen has re-implemented virtual
function tables with structs stuffed full of function pointers. C++ has native
support for object-oriented code. The language's native syntax allows
expression that's closer to a programmer's intention. C++ template
metaprogramming is vastly more capable than macro coding with the C
preprocessor. And the C++ standard library offers a broad array of
containers and algorithms. You're likely to be able to implement any given
task with less code in C++, from low-level bit shuffling to high-level state
logic."
---
"To sum up, I've worked on four games that shipped. MechAssault 2
sold several times as much as all of the others combined. I'm pretty sure
that MA2 is the only game I've worked on that made back its development
costs. I've been involved with code or engine design work for, depending
on what you count, about six games that haven't shipped." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Sep 13, 2006 5:54 pm Post subject: |
|
|
C arrays vs pointers and original discusion at Reddit: Jeez, after all
these years a C array vs pointer question
"However, that's never how the compiler actually translates A[i][j]. Last
night after finally focussing on this niggle of many years and posting it here
I actually looked at the assembly code gcc generates, and it turns out that A
[i][j] generates different code depending on whether A is declared as a [][]
array or an array of pointers (each malloc'd perhaps)." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Sep 15, 2006 4:48 pm Post subject: |
|
|
RC: Allocating and freeing memory across module boundaries
"I'm sure it's been drilled into your head by now that you have to free
memory with the same allocator that allocated it. LocalAlloc matches
LocalFree, GlobalAlloc matches GlobalFree, new[] matches delete[]. But
this rule goes deeper. " |
|
Back to top |
|
|
Guest
|
Posted: Fri Sep 15, 2006 11:38 pm Post subject: |
|
|
Google Blog: Nearly All Binary Searches and Mergesorts are Broken,
by Joshua Bloch
"This bug can manifest itself for arrays whose length (in elements) is 230
or greater (roughly a billion elements). This was inconceivable back in the
'80s, when Programming Pearls was written, but it is common these days at
Google and other places. In Programming Pearls, Bentley says "While the
first binary search was published in 1946, the first binary search that works
correctly for all values of n did not appear until 1962." The truth is, very few
correct versions have ever been published, at least in mainstream
programming languages." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Sep 21, 2006 10:31 pm Post subject: |
|
|
NASA: The Experience Factory
"The Software Engineering Laboratory (SEL) is an organization
sponsored by the National Aeronautics and Space Administration/Goddard
Space Flight Center (NASA/GSFC) and created to investigate the
effectiveness of software engineering technologies when applied to the
development of applications software.
The SEL was created in 1976 at NASA/GSFC for the purpose of
understanding and improving the overall software process and products
that were being created within one division of GSFC. The Experience
Factory organizational concept was introduced to institutionalize the
collective learning of the organization that is at the root of continual
improvement and competitive advantage. It establishes a separate
organizational element that supports reuse of experience and collective
learning by developing, updating, and delivering experience packages to
the Project Organization which is responsible for developing and
maintaining software." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Sep 30, 2006 12:09 pm Post subject: |
|
|
PDF: The New C Standard (Usage, Figures, and Tables)
An Economic and Cultural Commentary, by Derek M Jones
"This book contains a detailed analysis of the International Standard for the C language,-3.1 excluding the
library from a number of perspectives. The organization of the material is unusual in that it is based on
the actual text of the published C Standard. The unit of discussion is the individual sentences from the C
Standard (2022 of them)"
"The general principles driving the discussion that occurs in these coding guidelines subsections include:
1. the more practice people have performing some activity the better they become at performing it.
Many of the activities performed during source code comprehension (e.g., reasoning about sequences
of events and reading) not only occur in the everyday life of software developers but are likely to have
been performed significantly more often in an everyday context. Using existing practice provides a
benefit purely because it is existing practice. For a change to existing practice to be worthwhile the
total benefit has to be greater than the total cost (which needs to include relearning costs),
2. when performing a task people make implicitly cost/benefit trade-offs. One reason people make
mistakes is because they are not willing to pay a cost to obtain more accurate information than they
already have (e.g., relying on information available in their head rather expending effort searching for
it in the real world). While it might be possible to motivate people to make them more willing pay a
greater cost for less benefit the underlying trade-off behavior remains the same,
3. peoples information processing abilities are relatively limited and cannot physically be increased (this
is not to say that the cognitive strategies used cannot be improved to make the most efficient use of
these resources). In many ways the economics of software development is the economics of human
attention." |
|
Back to top |
|
|
Gnome Guest
|
Posted: Sat Sep 30, 2006 8:50 pm Post subject: |
|
|
Digg: SWIG (Simplified Wrapper and Interface Generator) : The Basics
"SWIG is a software development tool that connects programs written
in C and C++ with a variety of high-level programming languages. SWIG
is used with different types of languages including common scripting
languages such as Perl, PHP, Python, Tcl, Ruby and PHP."
See also: SWIG Users Manual |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Oct 17, 2006 7:36 pm Post subject: |
|
|
University of Kentucky: The Aggregate Magic Algorithms
"There are lots of people and places that create and collect algorithms of
all types. Unfortunately, in building systems hardware and software, we in
The Aggregate often have found it necessary to do relatively obscure
low-level things very efficiently. "
For example: Absolute Value of a Float
"IEEE floating point uses an explicit sign bit, so the absolute value can be
taken by a bitwise AND with the complement of the sign bit. For IA32
32-bit, the sign bit is an int value of 0x80000000, for IA32 64-bit, the sign
bit is the long long int value 0x8000000000000000. Of course, if you prefer
to use just int values, the IA32 64-bit sign bit is 0x80000000 at an int
address offset of +1." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Oct 28, 2006 8:36 pm Post subject: |
|
|
JoS: STL/Boost
"Regarding STL:
http://www.cppreference.com/index.html
provides a good selection of STL and other C++ topics. With nicely embedded
short examples. You can download the site entirely for local usage." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Nov 26, 2006 2:06 pm Post subject: |
|
|
Ten reasons why every programmer should learn C
"Every programmer should learn C during their programming career.
Its benefits are to numerous to ignore. Not only will it open many more
job opportunities, but it will teach you more about computers as a whole." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Fri Dec 01, 2006 1:40 pm Post subject: |
|
|
JoS: Pass by reference in a DLL call == pass a pointer?
Code: | // In other words, change
DLLEXPORT void foo(int *x) { *x = 6; }
// to
DLLEXPORT void foo(int &x) { x = 6; } |
"Should I let the calling code pass a pointer to a function that thinks it's
getting a reference, or should I leave the exported functions alone (and
passing pointers) for the sake of not having conflicting prototypes?" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Dec 02, 2006 1:19 pm Post subject: |
|
|
C Board: is knowing C enough !!
"You don't need C++ for anything in Windows. It just makes things a lot
easier. Especially using and writing COM objects."
C Board: Is windows programed with C or C++ ?!
"Originally Posted by MSDN
The single characteristic that sets the Microsoft Foundation Class (MFC)
Library apart from other class libraries for Windows is the very close
mapping to the Windows API written in the C language." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Dec 27, 2006 5:01 pm Post subject: |
|
|
CodeGuru: C++ Aha! Moments
"Scott Meyers' shares his Most Important Aha! Moments here : My Most
Important C++ Aha! Moments...Ever
It would be nice to hear what your most important "Aha!" moments are.. " |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Feb 17, 2007 6:44 pm Post subject: |
|
|
Is C is the new assembly?
"He suggests that a typical developer will write everything in Ruby or Python,
and then do performance testing. Anything that needs a speed-up can be
redone in Objective-C. You know, that “slow” dynamic variant of C " |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed Mar 28, 2007 5:55 pm Post subject: |
|
|
RC: Passing by address versus passing by reference, a puzzle
"Mind you, dereferencing an abstract object is highly unusual and will probably
cause the people who read your code to scratch their heads, but it is nevertheless
technically legal, in the same way it is technically legal to give a function that
deletes an item the name add_item." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Fri Aug 31, 2007 9:35 pm Post subject: |
|
|
JoS: Function pointer performance
"I'm starting to worry about the performance penalty of a 20-million
function-pointer calls versus 20-million normal function calls." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Oct 17, 2007 12:43 am Post subject: |
|
|
Ten things I love && hate about C
"And I’ve found that the more I use C, the less I dislike it. I wanted to write
up a bit of a tribute to the world’s most widespread system-level programming
language." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Sat Dec 01, 2007 7:36 pm Post subject: |
|
|
JoS: Setting up mac for development...
"I'm going to setup vm-ware to dev mac,win, and linux...
how would you set it up? drive partitioning? have logic-express too, so...
that needs it's own deal." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Fri Dec 28, 2007 6:50 pm Post subject: |
|
|
RC: If you need anything other than natural alignment, you have to ask for it
"...way to force alignment with the Visual C++ compiler is to use the
#pragma pack(#) directive. (There is also a "push" variation of this
pragma which remembers the previous ambient alignment, which can
be restored by a "pop" directive. And the /Zp# directive allows you to
specify this pragma from the compiler command line.)" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Feb 15, 2008 12:25 pm Post subject: |
|
|
JoS: Memory fragmentation
"Since there's no memory leaks and total used memory isn't going up, I
can only assume it's memory fragmentation leaving me unable to find a
large enough chunk of contiguous memory." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Apr 05, 2008 1:45 am Post subject: |
|
|
Robert J. Hansen - The continuing relevance of c:
"While it’s unargued that C is a language fraught with peril for the newcomer,
it allows the fine–grained control and blazing speed which are required for a
high–performance system. In essence, C solves exactly the problem for which
it was designed—and there’s absolutely no reason to be ashamed of something
which does its job well." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat May 03, 2008 2:20 am Post subject: |
|
|
CodeProject: XGetopt - A Unix-compatible getopt() for MFC and Win32
"In Unix, standard method is to call getopt(), but there is no equivalent in
Windows. I have gotten so used to getopt() that I like to use it even in new
Windows apps - it has a clean interface that is very understandable and
self-documenting." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Tue Jun 03, 2008 8:59 pm Post subject: |
|
|
CodeGuru: Managed Calls and Events in Unmanaged C++
"Nowadays, most of the developers and companies want to immigrate to
.NET. But, the question still is, how do you implement the new components
written in .NET in the old applications: Win32, MFC.... In this article, I will
explain how to develop an application in .NET and how to use it even in a
simple C++ application." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Jun 06, 2008 5:36 pm Post subject: |
|
|
Visual C++ Team Blog - Some C++ Gotchas
"At first glance, default-arguments seem to be a great C++ language feature
but I have seen them cause users no end of problems. I’ve even seen users
doing stuff like the following:
SomeFunction(arg1, arg2 /*, arg3 = false, arg4 = true */);
They do this just so it is clear to readers of the code that default arguments
are being used. If you are going to go this far then just get rid of the default
arguments (and the comments). Believe me that it will make your life much
easier and your code more maintainable!" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Jun 08, 2008 10:59 am Post subject: |
|
|
mistybeach.com - Why I Dislike C++ For Large Projects
"In a large program with raw pointers, the quality of the program will largely
be driven by the least talented members of the team. This makes it highly
dangerous to select a language that requires all the programmers to be in,
say, the top 25% of the talent pool. Given a team with 10 developers (and
my projects typically have more like 40-50), this seems to be asking for lots
of long term trouble." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Wed Nov 12, 2008 2:42 pm Post subject: |
|
|
Laurence Tratt: How can C Programs be so Reliable?
"Gradually it occurred to me that virtually all of the software that I use on a
daily a basis - that to which I entrust my most important data - is written in C.
And I can't remember the last time there was a major problem with any of
this software - it's reliable in the sense that it doesn't crash, and also reliable
in the sense that it handles minor failures gracefully." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Sat Jan 24, 2009 11:37 pm Post subject: |
|
|
MF - typedefs and Kochan 2.0
"If the range of values for the members does not fit into an int or unsigned
int, then the base type silently becomes 64-bit (long). The base type of qu-
antities defined as enumerations can thus change silently size to accord with
the values in the enumeration. This can happen whether you're compiling
32-bit or 64-bit. Needless to say, this situation presents obstacles for binary
compatibility." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Mar 20, 2009 10:53 pm Post subject: |
|
|
Microsoft Research: Reverse Engineering the Twelve Days of Christmas
"Having received the "Twelve Days of Christmas" obfuscated C program as
a Christmas present once too many times with out "opening" it, the author
decides to take on Jim Coplien's challenge to reverse engineer it. The use
of pretty printing and path profiling technology was found to be a very help-
ful aide in understanding the structure and the behavior of this program." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Mon Apr 20, 2009 4:35 pm Post subject: |
|
|
reddit - Is there really a difference between "dispatching a message" and calling a method?
"This Objective-C code:
[foo self];
can do any of these:
* Nothing, if foo is nil
* Raise an exception, if foo does not have a method called self
* Dynamically resolve the method, if resolveInstanceMethod: is implemented
* Forward the self message to another object, if forwardingTargetForSelector: is implemented
* Take an arbitrary action on the message and parameters, if forwardInvocation: is implemented
* Call the self method" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed May 06, 2009 10:48 pm Post subject: |
|
|
ibm - Best practices for programming in C
"We have put together a set of guidelines that have served us well as deve-
lopers and consultants over the years, and we offer these as suggestions
that may help you in your job. You may not agree with all of them but our
hope is you would like some of them and use them in your programming or
porting projects." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Jan 27, 2010 12:48 am Post subject: |
|
|
reddit Going back to C
"Because I really wanted that poster, I decided to switch to C because I
had this idea that nothing could fail in C. And I started to code in a lan-
guage I hadn't used for years, even a decade. And suddenly it hit me,
everything made sense." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Apr 06, 2010 10:41 pm Post subject: |
|
|
Jeff LaMarche: A Few More Notes on Creating Universal Apps
Code: | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
NSLog(@"iPad Idiom");
else
#else
NSLog(@"iPhone Idiom");
#endif |
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Sun Apr 09, 2017 1:04 pm Post subject: |
|
|
Jesse Daugherty - C++ in Xcode
"Contents:
1. Creating the Project
2. Command Line Arguments
3. Input Redirection - stdin
4. Input and Output files - fstream
5. Debugging
6. Source Control
7. Testing on CAEN" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed May 03, 2017 9:56 am Post subject: |
|
|
so - Qt Creator - Project ERROR: Xcode not set up properly.
"You may need to confirm the license agreement by running /usr/bin/xcodebuild"
"A better way is just to create symlink so you don't have to change .prf files
for all targets" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed May 24, 2017 10:34 am Post subject: |
|
|
so - How exactly does __attribute__((constructor)) work?
"So, the way the constructors and destructors work is that the shared object
file contains special sections (.ctors and .dtors on ELF) which contain referen-
ces to the functions marked with the constructor and destructor attributes,
respectively. When the library is loaded/unloaded the dynamic loader program
(ld.so or somesuch) checks whether such sections exist, and if so, calls the
functions referenced therein." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon May 29, 2017 8:25 pm Post subject: |
|
|
code monk - Stupid const, stupid mutable, stupid C++
"Every now and then someone drags me into a C++ discussion. I have friends
who code in C++. Some of them do it for money. I'm sorry about that." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon May 29, 2017 8:31 pm Post subject: |
|
|
Felix K - Reasons why C++ sucks
"Disclaimer: This list is not and will never be complete (but I may update it if
I'm bored). It also contains strong language." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon May 29, 2017 8:36 pm Post subject: |
|
|
so - C++ Return value, reference, const reference
"Can you explain to me the difference between returning value, reference to
value, and const reference to value?
Vector2D operator += (const Vector2D& vector)
{
}
Vector2D& operator += (const Vector2D& vector)
{
}
const Vector2D& operator += (const Vector2D& vector)
{
}" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon May 29, 2017 8:43 pm Post subject: |
|
|
codeproject.com - An Idiot's Guide to C++ Templates - Part 1
"Admitted that templates are slightly hard to learn, understand, and adapt.
Nevertheless, the advantages we gain from using templates would outweigh
the negatives. There is a lot more than generic functions or classes that can
be wrapped around templates. I would explicate them." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon May 29, 2017 8:49 pm Post subject: |
|
|
yosef k - C++ Frequently Questioned Answers
"This is a single page version of C++ FQA Lite. C++ is a general-purpose
programming language, not necessarily suitable for your special purpose.
* Defective C++ - a list of major language defects
* C++ Q&A, structured similarly to C++ FAQ Lite, with links to the original FAQ answers" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Thu Jun 08, 2017 10:30 am Post subject: |
|
|
Coders at Work - C++ in Coders at Work
"Interviews with Jamie Zawinsky, Joshua Bloch, Ken Thompson, Brendan
Eich, Brad Fitzpatrick, Dan Ingalls, Joe Armstrong and Guy Steele - the
people quoted as whining about C++.
I've never really learned it well enough to use in any serious way. And
unlike some other languages that I've not gotten around to learning, I
don't particularly regret that or have any plans to rectify the situation." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Thu Jun 08, 2017 10:52 am Post subject: |
|
|
more yosef k - C++ criticism by other people
"This page is a collection of the best C++ criticism by FQA readers, copied
from e-mail messages and online discussions. If you know an interesting
consequence of C++ problems not mentioned in the FQA, please send me
e-mail. Similarly to the FQA errors page, this one lists things that can be
proved / tested rather than qualitative statements. The stuff is published
with credits or anonymously, according to the choice of each author." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Sat Aug 19, 2017 5:30 pm Post subject: |
|
|
Zeljko Kovacevic - Why do we still use C++ Builder?
"As a C++ Builder developer for over 15 years and now a lecturer at Zagreb
University of Applied Sciences I immediately recognized C++ Builder as an
ideal tool for students. Developing applications visually by using components
and thus writing a minimal amount of design code greatly simplifies the process
of learning." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Mon Sep 09, 2019 2:47 pm Post subject: |
|
|
git - A type-safe dynamic array implementation for C: VEC
"Before using a vector it should first be initialised using the vec_init() function.
vec_int_t v;
vec_init(&v);
vec_push(&v, 123);
vec_push(&v, 456);
To access the elements of the vector directly the vector's data field can be used.
printf("%d\n", v.data[1]); /* Prints the value at index 1 */
The current length of the vector is stored in the length field of the vector
printf("%d\n", v.length); /* Prints the length of the vector */" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed Dec 16, 2020 5:25 pm Post subject: |
|
|
r - The C Template Library (github.com)
"I present a vector (vec.h) push_back example of type (T) int in the
README, but any type can be templated - even complex types with memory
ownership - given that _free, and _copy functions are defined for that type.
Templates, when expanded, are type safe (these are not macro expansions)
and will cleanly warn of type inconsistencies at compile time. Likewise,
templated compile time errors are limited and readable. Resulting binary
sizes are smaller than that of the STL, and compile drastically faster.
I've written a handful of examples to showcase its use (see the examples/
folder), notably a loop-unrolling 6502 compiler, a JSON parser, and an A*
path finder. If anyone is interested in trying it out, the discussions page is
open on GitHub" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Thu Mar 11, 2021 9:50 pm Post subject: |
|
|
r - Dennis Ritchie's first C compiler (c. 1972)
"The earliest versions of the very first c compiler known to exist in the wild
written by the late legend himself dmr.
These are not capable of being compiled today with modern c compilers like
gcc. I am only posting these here for the enjoyment and reminiscing of the
spark that ignited a soon to be trillion dollar industry. Enjoy. :)" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed Jul 14, 2021 9:25 pm Post subject: |
|
|
r - How to read complicated declarations?
I've been trying to understand how to read this, but at the end I just seem to broke my brain.
Code: | int (*(*func_ptr)(int(*)(int)))(int); |
Thanks in advance. |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Sun Jul 18, 2021 2:14 pm Post subject: |
|
|
r - Generic data structures in C
"Let's face it, The C Language is not friendly towards generic programming, but
we can use a few tricks:
Hacking with the #preprocessor
Using the flexibility of the void pointer (void*)
You can always try both of the approaches and see which one is more suitable
for your particular case."
Very nice tutorial on macros https://gcc.gnu.org/onlinedocs/cpp/Macros.html |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Sat Oct 30, 2021 3:14 pm Post subject: |
|
|
git - Args - An easy-to-use C library for parsing command line arguments
"Long-form boolean flags with single-character shortcuts: --flag, -f.
Long-form string, integer, and floating-point options with single-character
shortcuts: --option <arg>, -o <arg>.
Condensed short-form options: -abc <arg> <arg>.
Automatic --help and --version flags.
Support for multivalued options.
Support for git-style command interfaces with arbitrarily-nested commands." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Tue May 17, 2022 5:53 pm Post subject: |
|
|
geeksforgeeks.org - Designated Initializers in C
To specify an array index, write '[index] =' or '[index]' before the element value. For example,
int a[6] = {[4] = 29, [2] = 15 }; or
int a[6] = {[4]29 , [2]15 };
is equivalent to
int a[6] = { 0, 0, 15, 0, 29, 0 };
|
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed Dec 21, 2022 7:14 pm Post subject: |
|
|
leetcode.com - 1773. Count Items Matching a Rule
"You are given an array items, where each items[i] = [typei, colori, namei]
describes the type, color, and name of the ith item. You are also given a rule
represented by two strings, ruleKey and ruleValue." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Mon Feb 20, 2023 11:37 pm Post subject: |
|
|
git - TIGR - TIny GRaphics library
"TIGR is a tiny cross-platform graphics library, providing a unified API for
Windows, macOS, Linux, iOS and Android." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Fri Apr 21, 2023 5:59 pm Post subject: |
|
|
so - UBSan And Asan usage with GCC 4.9.2
"Unlike a static analysis check, this check will be done at run-time as explained
in the following blog entry: GCC Undefined Behavior Sanitizer - ubsan. It will
output a runtime error when it detects undefined behavior:
In order to check your program with ubsan, compile and link the program with
-fsanitize=undefined option. Such instrumented binaries have to be executed;
if ubsan detects any problem, it outputs a 'runtime error:' message, and in
most cases continues executing the program. There is a possibility of making
these diagnostic messages abort - just use the option -fno-sanitize-recover." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Sat May 20, 2023 6:09 pm Post subject: |
|
|
r - I am making a C Reddit API Wrapper
"CRAW is a Reddit API Wrapper that is being developed in C to scrape data
from reddit and make bots in C.
It is still under development and you can only use it to get your own data for
now but i will be working on this project to develop it as soon and possible. You
can build it and see if it works or not." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Mon Sep 04, 2023 7:36 pm Post subject: |
|
|
eclecticlight.co - Deprecation
"Unfortunately, ATSUI doesn't seem to be the only deprecation that's pursuing
this policy. Other unrelated API calls seem to result in similar dialogs and forced
exit, which one beta-tester has even experienced with the Finder."
https://mjtsai.com/blog/2023/06/26/ats-and-atsui-removal/
> The daemon that's showing this alert is replayd, it stores a boolean flag
for each bundle ID that it's displayed the alert for in its com.apple.replayd
preferences domain, so running defaults delete com.apple.replayd
<app_bundle_id> will make the alert pop up again. |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed Oct 04, 2023 4:46 pm Post subject: |
|
|
git - Fuzzing-101
"Do you want to learn how to fuzz like a real expert, but don't know how to start?
If so, this is the course for you!
10 real targets, 10 exercises. Are you able to solve all 10?" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3146 Location: Europe
|
Posted: Wed Oct 04, 2023 4:50 pm Post subject: |
|
|
bushido-sec.com - The art of Fuzzing: Introduction
"The goal of this article, is to give the reader the ability to fuzz target of their
choice by their own. Using AFL++ or being enough comfortable to write its own
script/software to fuzz programs. This course will not dive too deep into the
shadow realm of binary exploitation and vulnerability hunting, since it's not the
actual goal. However, it might be the subject of a future article." |
|
Back to top |
|
|
|