C+ is like halfway between C11 and C++.
Unlike C++, C+ remains a procedural language, and some things are intentionally left out.
Here are some potential ideas.
/* Created by easyaspi314. | |
* Released into the public domain. */ | |
#include <ctype.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#ifdef __SSE2__ | |
#include <immintrin.h> |
/* filename: OvercomplicatedWayToPrintA5x5Square.java */ | |
public class OvercomplicatedWayToPrintA5x5Square { | |
/* | |
* An abstract class representing a shape that can be printed to the console. | |
*/ | |
private static abstract class Shape { | |
/* | |
* Prints the contents of the shape to the console. | |
*/ | |
public abstract void printToConsole(); |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#if __STDC_VERSION__ >= 201112L | |
# include <stdnoreturn.h> | |
#elif defined(__GNUC__) | |
# define noreturn __attribute__((__noreturn__)) |
This is like gets
. It is a drop in for gets
. It is smarter though.
gets_safe
, which is aliased to gets
for convenience, takes an optional length argument, but it also uses GCC and Clang's __builtin_object_size
builtin to calculate the length.
The length will not always be calculated properly, but for static arrays and malloc
'd pointers in the current block with a fixed size (only with optimizations), it will usually pick up on it.
This also has a safety feature: If it can properly calculate the length and the supplied length is larger than the one it calculated, it will be an error. Additionally, when both the optional length parameter are omitted and the length cannot be calculated at compile time, it is an error.
#include "Product.h" | |
#include "ErrorState.h" | |
#include "iProduct.h" | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
static const struct iProductVtable Product_vtable; |
/* LIBGIMP - The GIMP Library | |
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball | |
* | |
* gimpcairo.c | |
* Copyright (C) 2007 Sven Neumann <sven@gimp.org> | |
* 2010-2012 Michael Natterer <mitch@gimp.org> | |
* | |
* This library is free software: you can redistribute it and/or | |
* modify it under the terms of the GNU Lesser General Public | |
* License as published by the Free Software Foundation; either |
/// | |
/// xxHash - Extremely Fast Hash algorithm | |
/// Rust implementation of XXH3_64bits | |
/// Copyright (C) 2019-present, Yann Collet. | |
/// | |
/// BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) | |
/// | |
/// Redistribution and use in source and binary forms, with or without | |
/// modification, are permitted provided that the following conditions are | |
/// met: |
Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.